Link to home
Start Free TrialLog in
Avatar of gbmcneil
gbmcneil

asked on

Is there a method to read a XML file in IExplorer that doesn't involve Msxml2.DOMDocument?

Hello Experts:

I'm the fellow that has been trying to read and display 30 records making up the Dow Industrial Index. I thought this was going to be a lot easier then it's turn out.

It seems that I am getting bogged down in just listing the beginning and ending prices of these stocks in a right juistified mode. Assuming that I overcome this problem (which no one seems to be able to solve), the next problem is going to be to limit each page to 15 records.

Now these problems seem to be monumental and it makes me wonder how other folks are succeeding in their respective projects if I can't even display a few records. This leads in turn leads me to think that maybe the problem is relying on Msxml2.DOMDocument and Msxml2.FreeThreadedDOMDocument to pull this off.

Should I be using another ActiveX Data Object here that is ADO like - that would give me better control over the recordset so that, for example, it would handle all the issues associated with paging, etc.

Am I on the right track here? Is Msxml2.DOMDocument the most up-to-date thing out there if I am willing to make my web application only compatible with IE 6.0 and 7.0?

Thanks for your help in advance.

Gordo


Avatar of sh0e
sh0e

The most recent version is Msxml2.DOMDocument.6.0
Msxml.DOMDocument
Msxml2.DOMDocument.3.0
Msxml2.DOMDocument.4.0

You want to use the SAX interface, which processes chunk by chunk, so it is faster.
Avatar of Gertone (Geert Bormans)
Hi Gordon,

The only and best way for dealing with XML in Internet Explorer is using the MSxml2.DOMDocument, as I showed you before.
As sh0e rightly says, you could use a more modern version of the activeX.
It doesn't matter too much, for the things you are doing

check which version of msxml you have installed. With IE7, I believe you would have msxml6, if not, you can install it manually
Instead of my earlier
  var oXML = new ActiveXObject("Msxml2.DOMDocument");
  var oXSL = new ActiveXObject("Msxml2.FreeThreadedDOMDocument");
  var oTmpl = new ActiveXObject("Msxml2.XSLTemplate");
do this
  var oXML = new ActiveXObject("Msxml2.DOMDocument.6.0");
  var oXSL = new ActiveXObject("Msxml2.FreeThreadedDOMDocument.6.0");
  var oTmpl = new ActiveXObject("Msxml2.XSLTemplate.6.0");

(I can also send you code that simply checks which version is installed and picks the most recent one on your machine)

Do you require your code to be used by others? Or just on your machine.... I can make everything you have done sofar more or less browser independent as well, if you need it to be that way.

About SAX, depending on how many records you are pulling from the Excel... I don't think you need to get into SAX for processing, it would just add to the complexity. We can see later

About succesfull projects? I have done plenty similar to what you are trying to do.
I suggest that you pull in all the records and we can then organise the paging from the XSLT and the JavaScript... piece of cake.

You might realise at some point that you need more than the help you can get from subsequent EE questions.
Just write me an email then, we can work something out (email is on my profile)

cheers

Geert
ASKER CERTIFIED SOLUTION
Avatar of Gertone (Geert Bormans)
Gertone (Geert Bormans)
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
and the HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Dow Jones for Gordon</title>
    <script language="javascript">
			function TransF(rec1,p) 
				{
			       // create and load the XML document
			       var oXML = new ActiveXObject("Msxml2.DOMDocument");
			       oXML.async = false;
			       oXML.load("Dow_Stocks_Data.xml");
			       // create and load the XSL document
			       var oXSL = new ActiveXObject("Msxml2.FreeThreadedDOMDocument");
			       oXSL.async = false;
			       oXSL.load("Dow-Stocks.xsl");
			       // create the template processor
			       var oTmpl = new ActiveXObject("Msxml2.XSLTemplate");
         		 oTmpl.stylesheet = oXSL;
		         oProc = oTmpl.createProcessor();
		         oProc.input = oXML;
		         // add parameters
		         oProc.addParameter("page", p);
		         oProc.addParameter("first", rec1);
		         // make the transform
						 oProc.transform();
         		 var resHTM = oProc.output;
         		 // write the transformation result as the inner HTML of the div
         		 document.getElementById("RB").innerHTML = resHTM;
        }
		</script>
</head>
 
<body>
	<div>
		<button type="SUBMIT" name="Button1" value="Button1" onclick="TransF(1,15);">
			<img src="button.gif"/>
		</button>
	</div>
	<div>
		<div id="RB"></div>
	<div>
</body>
</html>

Open in new window

Avatar of gbmcneil

ASKER

Hello Gertone:

I have studied the code you sent. Thanks very much for your input.

First off, I have your code running on the HTML side, however, I'm confused as to whether you intend for the the "page" value to be 1 or the "first" variable to be 1. Whichever the case, the other variable would equate to 15.

This inconsistency seems to continue to the XSL file. Here you suggest that:

<xsl:param name="page">15</xsl:param>
<xsl:param name="first">1</xsl:param>  

Aside from (I think) the values being reversed tou would think that there should be no reason to redefine the values in the XSL file if back in  the HTML file you've said:

oProc.addParameter("page", page);
oProc.addParameter("first", first);

and you've given "Page" the value of 1 and the value of "First", 15.

Beyond this, the line in the XSL file which says...

<xsl:variable name="cnt-NYSE" select="count(//Record[Exchange=!='NYSE'])"/>

is a show stopper. The execution locks up.

So, don't we want "Page" to equal 15 and "First" equal to 1? Also, if so, how would you suggest change the "Count" line so that it runs?

Thanks for your consideration.

Gordo








I have to check this
$first is the first record on the page, it should be 1 to start off
$page is the number of records on the page, it should be 15 always

   <xsl:param name="page">15</xsl:param>
    <xsl:param name="first">1</xsl:param>
is in the stylesheet for test purposes.
The values 15, and 1 here will only be used when testing in an IDE,
with the javascript they will always be given a value
They still need to be declared though
   <xsl:param name="page"/>
    <xsl:param name="first"/>
would be production code

I will check whether I made an error in thinking somewhere
Hello Gertone -

What with all the answers to my other questions, I have have an entirely new block of code to try to page through. I have made an attempt, but the processor locks up.

Given the increased complexity, I've increased the point value to 250.

Any thoughts where I've gone wrong?

Gordo
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:output indent="yes" method="html"/>
    <xsl:param name="price">All</xsl:param>
    <xsl:param name="sector">AMEX</xsl:param>
    <xsl:param name="sort">EquityName</xsl:param>
    <xsl:param name="first">1</xsl:param>
    <xsl:param name="page">15</xsl:param>
   
   
    <!-- Record select and sort -->
    <xsl:template match="Records">
    
    <DIV>
    <table border="1" width="500" cellpadding="3" cellspacing="3">
           
    	<xsl:call-template name="header"/>
	<xsl:choose>
		     	
	     <xsl:when test="$price='All' and $sort ='EquityName' and $sector='AMEX'">
	         <xsl:apply-templates select="Record[Exchange ='AMEX'] [EndPrice &gt; '10.00'] [position() &gt;= $first] [position() &lt; ($first + $page)]">
	         <xsl:sort select="EquityName" data-type="text" order="ascending"/>
	         </xsl:apply-templates>
	         <xsl:variable name="cnt-records" select="count(//Record[Exchange!='AMEX'] [EndPrice &gt; '10.00'])"/>
	     </xsl:when>
	   	          
	     <xsl:otherwise>
	     </xsl:otherwise>
	              
	</xsl:choose>     
	<th STYLE="bgcolor:#d4d0c8"> </th>      
    </table>
    
    <div>
            <xsl:variable name="new-first-p">
                <xsl:choose>
                    <xsl:when test="($first - $page - 1) > 1">
                    <xsl:value-of select="$first - $page - 1"/>
                    </xsl:when>
                    <xsl:otherwise>1
                    </xsl:otherwise>
                </xsl:choose>
            </xsl:variable>
            <xsl:variable name="new-first-n">
                <xsl:choose>
                    <xsl:when test="($first + $page) > $cnt-records">
                    <xsl:value-of select="$first"/>
                    </xsl:when>
                    <xsl:otherwise>
                    <xsl:value-of select="$first + $page"/>
                    </xsl:otherwise>
                </xsl:choose>
            </xsl:variable>
            <!-- previous -->
            <button type="SUBMIT" name="Previous" value="Previous" onclick="TransF({$new-first-p},{$page});">Previous</button>
                <!-- next -->
            <button type="SUBMIT" name="Next" value="Next" onclick="TransF({$new-first-n},{$page});">Next</button>
    </div>
    </DIV>
     
    
    </xsl:template>    
   
   
    <!-- Header row templates -->
    <xsl:template name="header">
        <tr>
            <th style="color: #000000; text-align: left; font-family: Arial, Helvetica ; font-weight: 900; font-size: 11px;">Symbol</th>	
	    <th style="color: #000000; text-align: left; font-family: Arial, Helvetica ; font-weight: 900; font-size: 11px;">Exchange</th> 	        
            <th style="color: #000000; text-align: left; font-family: Arial, Helvetica ; font-weight: 900; font-size: 11px;">EquityName</th>
            <th style="color: #000000; text-align: right; font-family: Arial, Helvetica ; font-weight: 900; font-size: 11px;">BeginPrice</th>
            <th style="color: #000000; text-align: right; font-family: Arial, Helvetica ; font-weight: 900; font-size: 11px;">EndPrice</th>
            <th style="color: #000000; text-align: right; font-family: Arial, Helvetica ; font-weight: 900; font-size: 11px;">Difference</th>
            <th style="color: #000000; text-align: right; font-family: Arial, Helvetica ; font-weight: 900; font-size: 11px;">Change</th>
        </tr>
    </xsl:template>
     
    <xsl:template match="Record">
        <tr>
            <xsl:if test="Difference &lt; 0">
                <xsl:attribute name="style">
                    <xsl:text>color: #990000;</xsl:text>
                </xsl:attribute>
            </xsl:if>
            <xsl:if test="Difference &gt; 0">
                <xsl:attribute name="style">
                    <xsl:text>color: #006B00;</xsl:text>
                </xsl:attribute>
            </xsl:if> 	
            
            <td><xsl:value-of select="Symbol"/></td>
            
            <td><xsl:value-of select="Exchange"/></td>
               
            <td><xsl:value-of select="EquityName"/></td>
             
            <td style="text-align: right;">
            <xsl:value-of select="format-number(BeginPrice, '#.00')"/></td>
             
            <td style="text-align: right; format-number(. , '#.00')">
            <xsl:value-of select="format-number(EndPrice, '#.00')"/></td>
                         
            <td style="text-align: right; format-number(. , '#.00')">
            <xsl:value-of select="format-number(Difference, '#.00')"/></td>
             
            <td style="text-align: right; format-number(. , '#.00')">
            <xsl:value-of select="format-number(Change, '#.00')"/></td>
         </tr>
    </xsl:template>
    
</xsl:stylesheet>

Open in new window

Hello Gertone -

To elaborate, I can add "[position() >= $first] [position() < ($first + $page)" to the "xsl: apply-templates select" area at the top of the XSL file. And, this code successfully limits the output to the first 15 records.

However, when I try to add the <DIV> where the variables "new-first-p" and "new-first-n" are quantified, the processor doesn't like that <DIV>. It locks up. So, it seems that we're close if we can get the system to accept that <DIV>.

Ideas?  Many thanks for your help so far.
Geritone -

The "xsl:variable name="new-first-n" doesn't like the variable "cnt-records".  I have calculated the value of "cnt-records" in the "xsl:template match="Records" section at the top.
That's Gertone not Geritone. Sorry!
Can you post the XSLT that errors out?
Gertone -

The entire code is shown below. If I tried to cut out 95% of the code (the selects and sorts), I'd probably only screw it up.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:output indent="yes" method="html"/>
    <xsl:param name="price">All</xsl:param>
    <xsl:param name="sector">All</xsl:param>
    <xsl:param name="sort">EquityName</xsl:param>
    <xsl:param name="first">1</xsl:param>
    <xsl:param name="page">15</xsl:param>
   
   
    <!-- Record select and sort -->
    <xsl:template match="Records">
    
    
    <table border="1" width="500" cellpadding="3" cellspacing="3">
                   
    	<xsl:call-template name="header"/>
	<xsl:choose>
		     	
	     <xsl:when test="$price='All' and $sort ='EquityName' and $sector='ALL'">
	         <xsl:apply-templates select="Record[Exchange !='XXXX'] [EndPrice &gt; '10.00'] [position() &gt;= $first] [position() &lt; ($first + $page)]">
	         <xsl:sort select="EquityName" data-type="text" order="ascending"/>
	         </xsl:apply-templates>
	         <xsl:variable name="cnt-records" select="count(//Record[Exchange!='XXXX'])"/>
	     </xsl:when>
	   
	     <xsl:when test="$price='1000' and $sort ='EquityName' and $sector='ALL'">
		 <xsl:apply-templates select="Record[Exchange !='XXXX'] [EndPrice &gt; '10.00']">
		 <xsl:sort select="EquityName" data-type="text" order="ascending"/>
	         </xsl:apply-templates>
	         <xsl:variable name="cnt-records" select="count(//Record[Exchange!='XXXX'] [EndPrice &gt; '10.00'])"/>
             </xsl:when>
	   	   	   	            
	     <xsl:when test="$price='999' and $sort ='EquityName' and $sector='ALL'">
	         <xsl:apply-templates select="Record[Exchange !='XXXX'] [EndPrice &gt; '00.99'] [EndPrice &lt; '9.99']">
	         <xsl:sort select="EquityName" data-type="text" order="ascending"/>
                 </xsl:apply-templates>
                 <xsl:variable name="cnt-records" select="count(//Record[Exchange!='XXXX'] [EndPrice &gt; '00.99'] [EndPrice &lt; '9.99'])"/>
             </xsl:when>
	     
	     <xsl:when test="$price='99' and $sort ='EquityName' and $sector='ALL'">
	         <xsl:apply-templates select="Record[Exchange !='XXXX'] [EndPrice &gt; '00.49'] [EndPrice &lt; '1.00']">
	         <xsl:sort select="EquityName" data-type="text" order="ascending"/>
                 </xsl:apply-templates>
                 <xsl:variable name="cnt-records" select="count(//Record[Exchange!='XXXX'] [EndPrice &gt; '00.49'] [EndPrice &lt; '1.00'])"/> 
             </xsl:when>
	     	     
	     <xsl:when test="$price='49' and $sort ='EquityName' and $sector='ALL'">
	         <xsl:apply-templates select="Record[Exchange !='XXXX'] [EndPrice &lt; '00.50']">
	         <xsl:sort select="EquityName" data-type="text" order="ascending"/>
                 </xsl:apply-templates>
                 <xsl:variable name="cnt-records" select="count(//Record[Exchange!='XXXX'] [EndPrice &lt; '00.50'])"/> 
             </xsl:when>
	      
	          
	          
	     <xsl:when test="$price='All' and $sort ='EquityName' and $sector='AMEX'">
	         <xsl:apply-templates select="Record[Exchange ='AMEX']">
	         <xsl:sort select="EquityName" data-type="text" order="ascending"/>
	         </xsl:apply-templates>
	         <xsl:variable name="cnt-records" select="count(//Record[Exchange!='AMEX'])"/>
	     </xsl:when>
	     
             <xsl:when test="$price='1000' and $sort ='EquityName' and $sector='AMEX'">
	         <xsl:apply-templates select="Record[Exchange ='AMEX'] [EndPrice &gt; '10.00']">
	         <xsl:sort select="EquityName" data-type="text" order="ascending"/>
                 </xsl:apply-templates>
                 <xsl:variable name="cnt-records" select="count(//Record[Exchange!='AMEX'] [EndPrice &gt; '10.00'])"/>
             </xsl:when>
	   	   	   	            
	     <xsl:when test="$price='999' and $sort ='EquityName' and $sector='AMEX'">
	         <xsl:apply-templates select="Record[Exchange ='AMEX'] [EndPrice &gt; '00.99'] [EndPrice &lt; '9.99']">
	         <xsl:sort select="EquityName" data-type="text" order="ascending"/>
                 </xsl:apply-templates>
                 <xsl:variable name="cnt-records" select="count(//Record[Exchange!='AMEX'] [EndPrice &gt; '00.99'] [EndPrice &lt; '9.99'])"/>
             </xsl:when>
	     
	     <xsl:when test="$price='99' and $sort ='EquityName' and $sector='AMEX'">
	         <xsl:apply-templates select="Record[Exchange ='AMEX'] [EndPrice &gt; '00.49'] [EndPrice &lt; '1.00']">
	         <xsl:sort select="EquityName" data-type="text" order="ascending"/>
                 </xsl:apply-templates>
                 <xsl:variable name="cnt-records" select="count(//Record[Exchange!='AMEX'] [EndPrice &gt; '00.49'] [EndPrice &lt; '1.00'])"/>
             </xsl:when>
	     
	     <xsl:when test="$price='49' and $sort ='EquityName' and $sector='AMEX'">
	         <xsl:apply-templates select="Record[Exchange ='AMEX'] [EndPrice &lt; '00.50']">
	         <xsl:sort select="EquityName" data-type="text" order="ascending"/>
                 </xsl:apply-templates>
                 <xsl:variable name="cnt-records" select="count(//Record[Exchange!='AMEX'] [EndPrice &lt; '00.50'])"/> 
             </xsl:when>
                      
                         
             
             <xsl:when test="$price='All' and $sort ='EquityName' and $sector='NASDAQ'">
	         <xsl:apply-templates select="Record[Exchange ='NASDAQ']">
	         <xsl:sort select="EquityName" data-type="text" order="ascending"/>
	         </xsl:apply-templates>
	         <xsl:variable name="cnt-records" select="count(//Record[Exchange='NASDAQ'])"/>
             </xsl:when>
	   
	     <xsl:when test="$price='1000' and $sort ='EquityName' and $sector='NASDAQ'">
	         <xsl:apply-templates select="Record[Exchange ='NASDAQ'] [EndPrice &gt; '10.00']">
	         <xsl:sort select="EquityName" data-type="text" order="ascending"/>
                 </xsl:apply-templates>
                 <xsl:variable name="cnt-records" select="count(//Record[Exchange='NASDAQ'] [EndPrice &gt; '10.00'])"/>
             </xsl:when>
	   	   	   	            
	     <xsl:when test="$price='999' and $sort ='EquityName' and $sector='NASDAQ'">
	         <xsl:apply-templates select="Record[Exchange ='NASDAQ'] [EndPrice &gt; '00.99'] [EndPrice &lt; '9.99']">
	         <xsl:sort select="EquityName" data-type="text" order="ascending"/>
                 </xsl:apply-templates>
                 <xsl:variable name="cnt-records" select="count(//Record[Exchange='NASDAQ'] [EndPrice &gt; '00.99'] [EndPrice &lt; '9.99'])"/>
             </xsl:when>
	     
	     <xsl:when test="$price='99' and $sort ='EquityName' and $sector='NASDAQ'">
	         <xsl:apply-templates select="Record[Exchange ='NASDAQ'] [EndPrice &gt; '00.49'] [EndPrice &lt; '1.00']">
	         <xsl:sort select="EquityName" data-type="text" order="ascending"/>
                 </xsl:apply-templates>
                 <xsl:variable name="cnt-records" select="count(//Record[Exchange='NASDAQ'] [EndPrice &gt; '00.49'] [EndPrice &lt; '1.00'])"/>
             </xsl:when>
	     
	     <xsl:when test="$price='49' and $sort ='EquityName' and $sector='NASDAQ'">
	         <xsl:apply-templates select="Record[Exchange ='NASDAQ'] [EndPrice &lt; '00.50']">
	         <xsl:sort select="EquityName" data-type="text" order="ascending"/>
                 </xsl:apply-templates>
                 <xsl:variable name="cnt-records" select="count(//Record[Exchange='NASDAQ'] [EndPrice &lt; '00.50'])"/>
             </xsl:when>
             
             
             
             <xsl:when test="$price='All' and $sort ='EquityName' and $sector='NYSE'">
	         <xsl:apply-templates select="Record[Exchange ='NYSE']">
	         <xsl:sort select="EquityName" data-type="text" order="ascending"/>
	         </xsl:apply-templates>
	         <xsl:variable name="cnt-records" select="count(//Record[Exchange='NYSE'])"/>
	     </xsl:when>
	   
	     <xsl:when test="$price='1000' and $sort ='EquityName' and $sector='NYSE'">
	         <xsl:apply-templates select="Record[Exchange ='NYSE'] [EndPrice &gt; '10.00']">
	         <xsl:sort select="EquityName" data-type="text" order="ascending"/>
                 </xsl:apply-templates>
                 <xsl:variable name="cnt-records" select="count(//Record[Exchange='NYSE'] [EndPrice &gt; '10.00'])"/>
             </xsl:when>
	   	   	   	            
	     <xsl:when test="$price='999' and $sort ='EquityName' and $sector='NYSE'">
	         <xsl:apply-templates select="Record[Exchange ='NYSE'] [EndPrice &gt; '00.99'] [EndPrice &lt; '9.99']">
	         <xsl:sort select="EquityName" data-type="text" order="ascending"/>
                 </xsl:apply-templates>
                 <xsl:variable name="cnt-records" select="count(//Record[Exchange='NYSE'] [EndPrice &gt; '00.99'] [EndPrice &lt; '9.99'])"/>
             </xsl:when>
	     
	     <xsl:when test="$price='99' and $sort ='EquityName' and $sector='NYSE'">
	         <xsl:apply-templates select="Record[Exchange ='NYSE'] [EndPrice &gt; '00.49'] [EndPrice &lt; '1.00']">
	         <xsl:sort select="EquityName" data-type="text" order="ascending"/>
                 </xsl:apply-templates>
                 <xsl:variable name="cnt-records" select="count(//Record[Exchange='NYSE'] [EndPrice &gt; '00.49'] [EndPrice &lt; '1.00'])"/>
             </xsl:when>
	     
	     <xsl:when test="$price='49' and $sort ='EquityName' and $sector='NYSE'">
	         <xsl:apply-templates select="Record[Exchange ='NYSE'] [EndPrice &lt; '00.50']">
	         <xsl:sort select="EquityName" data-type="text" order="ascending"/>
                 </xsl:apply-templates>
                 <xsl:variable name="cnt-records" select="count(//Record[Exchange='NYSE'] [EndPrice &lt; '00.50'])"/>
             </xsl:when>
             
                         
             
             
             
             <xsl:when test="$price='All' and $sort ='Change' and $sector='ALL'">
	         <xsl:apply-templates select="Record[Exchange !='XXXX']">
	         <xsl:sort select="Change" data-type="number" order="descending"/>
	         </xsl:apply-templates>
	         <xsl:variable name="cnt-records" select="count(//Record[Exchange!='XXXX'])"/>
	     </xsl:when>
	   
	     <xsl:when test="$price='1000' and $sort ='Change' and $sector='ALL'">
	         <xsl:apply-templates select="Record[Exchange !='XXXX'] [EndPrice &gt; '10.00']">
	         <xsl:sort select="Change" data-type="number" order="descending"/>
                 </xsl:apply-templates>
                 <xsl:variable name="cnt-records" select="count(//Record[Exchange!='XXXX'] [EndPrice &gt; '10.00'])"/>
             </xsl:when>
	   	   	   	            
	     <xsl:when test="$price='999' and $sort ='Change' and $sector='ALL'">
	         <xsl:apply-templates select="Record[Exchange !='XXXX'] [EndPrice &gt; '00.99'] [EndPrice &lt; '9.99']">
	         <xsl:sort select="Change" data-type="number" order="descending"/>
                 </xsl:apply-templates>
                 <xsl:variable name="cnt-records" select="count(//Record[Exchange!='XXXX'] [EndPrice &gt; '00.99'] [EndPrice &lt; '9.99'])"/>
             </xsl:when>
	     
	     <xsl:when test="$price='99' and $sort ='Change' and $sector='ALL'">
	         <xsl:apply-templates select="Record[Exchange !='XXXX'] [EndPrice &gt; '00.49'] [EndPrice &lt; '1.00']">
	         <xsl:sort select="Change" data-type="number" order="descending"/>
                 </xsl:apply-templates>
                 <xsl:variable name="cnt-records" select="count(//Record[Exchange!='XXXX'] [EndPrice &gt; '00.49'] [EndPrice &lt; '1.00'])"/>
             </xsl:when>
	     
	     <xsl:when test="$price='49' and $sort ='Change' and $sector='ALL'">
	         <xsl:apply-templates select="Record[Exchange !='XXXX'] [EndPrice &lt; '00.50']">
	         <xsl:sort select="Change" data-type="number" order="descending"/>
	         </xsl:apply-templates>
	         <xsl:variable name="cnt-records" select="count(//Record[Exchange!='XXXX'] [EndPrice &lt; '00.50'])"/>
             </xsl:when>
	    
	    
	    
	              
	     <xsl:when test="$price='All' and $sort ='Change' and $sector='AMEX'">
	         <xsl:apply-templates select="Record[Exchange ='AMEX']">
	         <xsl:sort select="Change" data-type="number" order="descending"/>
	         </xsl:apply-templates>
	         <xsl:variable name="cnt-records" select="count(//Record[Exchange='AMEX'])"/>
	     </xsl:when>
	     
             <xsl:when test="$price='1000' and $sort ='Change' and $sector='AMEX'">
	         <xsl:apply-templates select="Record[Exchange ='AMEX'] [EndPrice &gt; '10.00']">
	         <xsl:sort select="Change" data-type="number" order="descending"/>
                 </xsl:apply-templates>
                 <xsl:variable name="cnt-records" select="count(//Record[Exchange='AMEX'] [EndPrice &gt; '10.00'])"/>
             </xsl:when>
	   	   	   	            
	     <xsl:when test="$price='999' and $sort ='Change' and $sector='AMEX'">
	         <xsl:apply-templates select="Record[Exchange ='AMEX'] [EndPrice &gt; '00.99'] [EndPrice &lt; '9.99']">
	         <xsl:sort select="Change" data-type="number" order="descending"/>
                 </xsl:apply-templates>
                 <xsl:variable name="cnt-records" select="count(//Record[Exchange='AMEX'] [EndPrice &gt; '00.99'] [EndPrice &lt; '9.99'])"/>
             </xsl:when>
	     
	     <xsl:when test="$price='99' and $sort ='Change' and $sector='AMEX'">
	         <xsl:apply-templates select="Record[Exchange ='AMEX'] [EndPrice &gt; '00.49'] [EndPrice &lt; '1.00']">
	         <xsl:sort select="Change" data-type="number" order="descending"/>
                 </xsl:apply-templates>
                 <xsl:variable name="cnt-records" select="count(//Record[Exchange='AMEX'] [EndPrice &gt; '00.49'] [EndPrice &lt; '1.00'])"/>
             </xsl:when>
	     
	     <xsl:when test="$price='49' and $sort ='Change' and $sector='AMEX'">
	         <xsl:apply-templates select="Record[Exchange ='AMEX'] [EndPrice &lt; '00.50']">
	         <xsl:sort select="Change" data-type="number" order="descending"/>
                 </xsl:apply-templates>
                 <xsl:variable name="cnt-records" select="count(//Record[Exchange='AMEX'] [EndPrice &lt; '00.50'])"/>
             </xsl:when>
                         
             
             
             <xsl:when test="$price='All' and $sort ='Change' and $sector='NASDAQ'">
	         <xsl:apply-templates select="Record[Exchange ='NASDAQ']">
	         <xsl:sort select="Change" data-type="number" order="descending"/>
	         </xsl:apply-templates>
	         <xsl:variable name="cnt-records" select="count(//Record[Exchange='NASDAQ'])"/>
	     </xsl:when>
	   
	     <xsl:when test="$price='1000' and $sort ='Change' and $sector='NASDAQ'">
	         <xsl:apply-templates select="Record[Exchange ='NASDAQ'] [EndPrice &gt; '10.00']">
	         <xsl:sort select="Change" data-type="number" order="descending"/>
                 </xsl:apply-templates>
                 <xsl:variable name="cnt-records" select="count(//Record[Exchange='NASDAQ'] [EndPrice &gt; '10.00'])"/>
             </xsl:when>
	   	   	   	            
	     <xsl:when test="$price='999' and $sort ='Change' and $sector='NASDAQ'">
	         <xsl:apply-templates select="Record[Exchange ='NASDAQ'] [EndPrice &gt; '00.99'] [EndPrice &lt; '9.99']">
	         <xsl:sort select="Change" data-type="number" order="descending"/>
                 </xsl:apply-templates>
                 <xsl:variable name="cnt-records" select="count(//Record[Exchange='NASDAQ'] [EndPrice &gt; '00.99'] [EndPrice &lt; '9.99'])"/> 
             </xsl:when>
	     
	     <xsl:when test="$price='99' and $sort ='Change' and $sector='NASDAQ'">
	         <xsl:apply-templates select="Record[Exchange ='NASDAQ'] [EndPrice &gt; '00.49'] [EndPrice &lt; '1.00']">
	         <xsl:sort select="Change" data-type="number" order="descending"/>
                 </xsl:apply-templates>
                 <xsl:variable name="cnt-records" select="count(//Record[Exchange='NASDAQ'] [EndPrice &gt; '00.49'] [EndPrice &lt; '1.00'])"/>
             </xsl:when>
	     
	     <xsl:when test="$price='49' and $sort ='Change' and $sector='NASDAQ'">
	         <xsl:apply-templates select="Record[Exchange ='NASDAQ'] [EndPrice &lt; '00.50']">
	         <xsl:sort select="Change" data-type="number" order="descending"/>
                 </xsl:apply-templates>
                 <xsl:variable name="cnt-records" select="count(//Record[Exchange='NASDAQ'] [EndPrice &lt; '00.50'])"/>
             </xsl:when>
             
             
             
             <xsl:when test="$price='All' and $sort ='Change' and $sector='NYSE'">
	         <xsl:apply-templates select="Record[Exchange ='NYSE']">
	         <xsl:sort select="Change" data-type="number" order="descending"/>
	         </xsl:apply-templates>
	         <xsl:variable name="cnt-records" select="count(//Record[Exchange='NYSE'])"/>
             </xsl:when>
	   
	     <xsl:when test="$price='1000' and $sort ='Change' and $sector='NYSE'">
	         <xsl:apply-templates select="Record[Exchange ='NYSE'] [EndPrice &gt; '10.00']">
	         <xsl:sort select="Change" data-type="number" order="descending"/>
                 </xsl:apply-templates>
                 <xsl:variable name="cnt-records" select="count(//Record[Exchange='NYSE'] [EndPrice &gt; '10.00'])"/>
             </xsl:when>
	   	   	   	            
	     <xsl:when test="$price='999' and $sort ='Change' and $sector='NYSE'">
	         <xsl:apply-templates select="Record[Exchange ='NYSE'] [EndPrice &gt; '00.99'] [EndPrice &lt; '9.99']">
	         <xsl:sort select="Change" data-type="number" order="descending"/>
                 </xsl:apply-templates>
                 <xsl:variable name="cnt-records" select="count(//Record[Exchange='NYSE'] [EndPrice &gt; '00.99'] [EndPrice &lt; '9.99'])"/>
             </xsl:when>
	     
	     <xsl:when test="$price='99' and $sort ='Change' and $sector='NYSE'">
	         <xsl:apply-templates select="Record[Exchange ='NYSE'] [EndPrice &gt; '00.49'] [EndPrice &lt; '1.00']">
	         <xsl:sort select="Change" data-type="number" order="descending"/>
                 </xsl:apply-templates>
                 <xsl:variable name="cnt-records" select="count(//Record[Exchange='NYSE'] [EndPrice &gt; '00.49'] [EndPrice &lt; '1.00'])"/>
             </xsl:when>
	     
	     <xsl:when test="$price='49' and $sort ='Change' and $sector='NYSE'">
	         <xsl:apply-templates select="Record[Exchange ='NYSE'] [EndPrice &lt; '00.50']">
	         <xsl:sort select="Change" data-type="number" order="descending"/>
                 </xsl:apply-templates>
                 <xsl:variable name="cnt-records" select="count(//Record[Exchange='NYSE'] [EndPrice &lt; '00.50'])"/>
             </xsl:when>
            
            
            
                                 
	     <xsl:when test="$price='All' and $sort ='EndPrice' and $sector='ALL'">
	         <xsl:apply-templates select="Record[Exchange !='XXXX']">
	         <xsl:sort select="EndPrice" data-type="number" order="descending"/>
	         </xsl:apply-templates>
	         <xsl:variable name="cnt-records" select="count(//Record[Exchange!='XXXX'])"/>
	     </xsl:when>
	   
	     <xsl:when test="$price='1000' and $sort ='EndPrice' and $sector='ALL'">
	         <xsl:apply-templates select="Record[Exchange !='XXXX'] [EndPrice &gt; '10.00']">
	         <xsl:sort select="EndPrice" data-type="number" order="descending"/>
                 </xsl:apply-templates>
                 <xsl:variable name="cnt-records" select="count(//Record[Exchange!='XXXX'] [EndPrice &gt; '10.00'])"/>
             </xsl:when>
	   	   	   	            
	     <xsl:when test="$price='999' and $sort ='EndPrice' and $sector='ALL'">
	         <xsl:apply-templates select="Record[Exchange !='XXXX'] [EndPrice &gt; '00.99'] [EndPrice &lt; '9.99']">
	         <xsl:sort select="EndPrice" data-type="number" order="descending"/>
                 </xsl:apply-templates>
                 <xsl:variable name="cnt-records" select="count(//Record[Exchange!='XXXX'] [EndPrice &gt; '00.99'] [EndPrice &lt; '9.99'])"/>
             </xsl:when>
	     
	     <xsl:when test="$price='99' and $sort ='EndPrice' and $sector='ALL'">
	         <xsl:apply-templates select="Record[Exchange !='XXXX'] [EndPrice &gt; '00.49'] [EndPrice &lt; '1.00']">
	         <xsl:sort select="EndPrice" data-type="number" order="descending"/>
                 </xsl:apply-templates>
                 <xsl:variable name="cnt-records" select="count(//Record[Exchange!='XXXX'] [EndPrice &gt; '00.49'] [EndPrice &lt; '1.00'])"/>    
             </xsl:when>
	     
	     <xsl:when test="$price='49' and $sort ='EndPrice' and $sector='ALL'">
	         <xsl:apply-templates select="Record[Exchange !='XXXX'] [EndPrice &lt; '00.50']">
	         <xsl:sort select="EndPrice" data-type="number" order="descending"/>
                 </xsl:apply-templates>
                 <xsl:variable name="cnt-records" select="count(//Record[Exchange!='XXXX'] [EndPrice &lt; '00.50'])"/>
             </xsl:when>
	      
	          
	          
	          
	     <xsl:when test="$price='All' and $sort ='EndPrice' and $sector='AMEX'">
	         <xsl:apply-templates select="Record[Exchange ='AMEX']">
	         <xsl:sort select="EndPrice" data-type="number" order="descending"/>
	         </xsl:apply-templates>
	         <xsl:variable name="cnt-records" select="count(//Record[Exchange='AMEX'])"/>
	     </xsl:when>
	     
             <xsl:when test="$price='1000' and $sort ='EndPrice' and $sector='AMEX'">
	         <xsl:apply-templates select="Record[Exchange ='AMEX'] [EndPrice &gt; '10.00']">
	         <xsl:sort select="EndPrice" data-type="number" order="descending"/>
                 </xsl:apply-templates>
                 <xsl:variable name="cnt-records" select="count(//Record[Exchange='AMEX'] [EndPrice &gt; '10.00'])"/>
             </xsl:when>
	   	   	   	            
	     <xsl:when test="$price='999' and $sort ='EndPrice' and $sector='AMEX'">
	         <xsl:apply-templates select="Record[Exchange ='AMEX'] [EndPrice &gt; '00.99'] [EndPrice &lt; '9.99']">
	         <xsl:sort select="EndPrice" data-type="number" order="descending"/>
                 </xsl:apply-templates>
                 <xsl:variable name="cnt-records" select="count(//Record[Exchange='AMEX'] [EndPrice &gt; '00.99'] [EndPrice &lt; '9.99'])"/>
             </xsl:when>
	     
	     <xsl:when test="$price='99' and $sort ='EndPrice' and $sector='AMEX'">
	         <xsl:apply-templates select="Record[Exchange ='AMEX'] [EndPrice &gt; '00.49'] [EndPrice &lt; '1.00']">
	         <xsl:sort select="EndPrice" data-type="number" order="descending"/>
                 </xsl:apply-templates>
                 <xsl:variable name="cnt-records" select="count(//Record[Exchange='AMEX'] [EndPrice &gt; '00.49'] [EndPrice &lt; '1.00'])"/>
             </xsl:when>
	     
	     <xsl:when test="$price='49' and $sort ='EndPrice' and $sector='AMEX'">
	         <xsl:apply-templates select="Record[Exchange ='AMEX'] [EndPrice &lt; '00.50']">
	         <xsl:sort select="EndPrice" data-type="number" order="descending"/>
                 </xsl:apply-templates>
                 <xsl:variable name="cnt-records" select="count(//Record[Exchange='AMEX'] [EndPrice &lt; '00.50'])"/>
             </xsl:when>
                 
                         
             
             <xsl:when test="$price='All' and $sort ='EndPrice' and $sector='NASDAQ'">
	         <xsl:apply-templates select="Record[Exchange ='NASDAQ']">
	         <xsl:sort select="EndPrice" data-type="number" order="descending"/>
	         </xsl:apply-templates>
	         <xsl:variable name="cnt-records" select="count(//Record[Exchange='NASDAQ'])"/>
	     </xsl:when>
	   
	     <xsl:when test="$price='1000' and $sort ='EndPrice' and $sector='NASDAQ'">
	         <xsl:apply-templates select="Record[Exchange ='NASDAQ'] [EndPrice &gt; '10.00']">
	         <xsl:sort select="EndPrice" data-type="number" order="descending"/>
                 </xsl:apply-templates>
                 <xsl:variable name="cnt-records" select="count(//Record[Exchange='NASDAQ'] [EndPrice &gt; '10.00'])"/>
             </xsl:when>
	   	   	   	            
	     <xsl:when test="$price='999' and $sort ='EndPrice' and $sector='NASDAQ'">
	         <xsl:apply-templates select="Record[Exchange ='NASDAQ'] [EndPrice &gt; '00.99'] [EndPrice &lt; '9.99']">
	         <xsl:sort select="EndPrice" data-type="number" order="descending"/>
                 </xsl:apply-templates>
                 <xsl:variable name="cnt-records" select="count(//Record[Exchange='NASDAQ'] [EndPrice &gt; '00.99'] [EndPrice &lt; '9.99'])"/> 
             </xsl:when>
	     
	     <xsl:when test="$price='99' and $sort ='EndPrice' and $sector='NASDAQ'">
	         <xsl:apply-templates select="Record[Exchange ='NASDAQ'] [EndPrice &gt; '00.49'] [EndPrice &lt; '1.00']">
	         <xsl:sort select="EndPrice" data-type="number" order="descending"/>
                 </xsl:apply-templates>
                 <xsl:variable name="cnt-records" select="count(//Record[Exchange='NASDAQ'] [EndPrice &gt; '00.49'] [EndPrice &lt; '1.00'])"/>
             </xsl:when>
	     
	     <xsl:when test="$price='49' and $sort ='EndPrice' and $sector='NASDAQ'">
	         <xsl:apply-templates select="Record[Exchange ='NASDAQ'] [EndPrice &lt; '00.50']">
	         <xsl:sort select="EndPrice" data-type="number" order="descending"/>
                 </xsl:apply-templates>
                 <xsl:variable name="cnt-records" select="count(//Record[Exchange='NASDAQ'] [EndPrice &lt; '00.50'])"/>
             </xsl:when>
             
             
             
             <xsl:when test="$price='All' and $sort ='EndPrice' and $sector='NYSE'">
	         <xsl:apply-templates select="Record[Exchange ='NYSE']">
	         <xsl:sort select="EndPrice" data-type="number" order="descending"/>
	         </xsl:apply-templates>
	         <xsl:variable name="cnt-records" select="count(//Record[Exchange='NYSE'])"/>
	     </xsl:when>
	   
	     <xsl:when test="$price='1000' and $sort ='EndPrice' and $sector='NYSE'">
	         <xsl:apply-templates select="Record[Exchange ='NYSE'] [EndPrice &gt; '10.00']">
	         <xsl:sort select="EndPrice" data-type="number" order="descending"/>
                 </xsl:apply-templates>
                 <xsl:variable name="cnt-records" select="count(//Record[Exchange='NYSE'] [EndPrice &gt; '10.00'])"/>
             </xsl:when>
	   	   	   	            
	     <xsl:when test="$price='999' and $sort ='EndPrice' and $sector='NYSE'">
	         <xsl:apply-templates select="Record[Exchange ='NYSE'] [EndPrice &gt; '00.99'] [EndPrice &lt; '9.99']">
	         <xsl:sort select="EndPrice" data-type="number" order="descending"/>
                 </xsl:apply-templates>
                 <xsl:variable name="cnt-records" select="count(//Record[Exchange='NYSE'] [EndPrice &gt; '00.99'] [EndPrice &lt; '9.99'])"/>
             </xsl:when>
	     
	     <xsl:when test="$price='99' and $sort ='EndPrice' and $sector='NYSE'">
	          <xsl:apply-templates select="Record[Exchange ='NYSE'] [EndPrice &gt; '00.49'] [EndPrice &lt; '1.00']">
	          <xsl:sort select="EndPrice" data-type="number" order="descending"/>
                  </xsl:apply-templates>
                  <xsl:variable name="cnt-records" select="count(//Record[Exchange='NYSE'] [EndPrice &gt; '00.49'] [EndPrice &lt; '1.00'])"/>
             </xsl:when>
	     
	     <xsl:when test="$price='49' and $sort ='EndPrice' and $sector='NYSE'">
	          <xsl:apply-templates select="Record[Exchange ='NYSE'] [EndPrice &lt; '00.50']">
	          <xsl:sort select="EndPrice" data-type="number" order="descending"/>
                  </xsl:apply-templates>
                  <xsl:variable name="cnt-records" select="count(//Record[Exchange='NYSE'] [EndPrice &lt; '00.50'])"/>
             </xsl:when>
	     </xsl:choose>     
	     <th STYLE="bgcolor:#d4d0c8"> </th>
	</table>
	
	
	<div>
	<xsl:variable name="new-first-p">
                <xsl:choose>
                    <xsl:when test="($first - $page - 1) > 1">
                    <xsl:value-of select="$first - $page - 1"/>
                    </xsl:when>
                    <xsl:otherwise>1
                    </xsl:otherwise>
                </xsl:choose>
        </xsl:variable>
        <xsl:variable name="new-first-n">
                <xsl:choose>
                    <xsl:when test="($first + $page) > {$cnt-records}">
                    <xsl:value-of select="$first"/>
                    </xsl:when>
                    <xsl:otherwise>
                    <xsl:value-of select="$first + $page"/>
                    </xsl:otherwise>
                </xsl:choose>
        </xsl:variable>
  
  	<!-- Navigation Buttons
        <button type="SUBMIT" name="Previous" value="Previous" onClick="TransF({$price}, {$sector}, {$sort), {$new-first-p} ,{$page});">Previous</button>
        <button type="SUBMIT" name="Next" value="Next" onClick="TransF({$price}, {$sector}, {$sort), {$new-first-n}, {$page});">Next</button>
         -->   
  
	
	</div>
	
	   	    
    </xsl:template>
    
       
    <!-- Header row templates -->
    <xsl:template name="header">
        <tr>
            <th style="color: #000000; text-align: left; font-family: Arial, Helvetica ; font-weight: 900; font-size: 11px;">Symbol</th>	
	    <th style="color: #000000; text-align: left; font-family: Arial, Helvetica ; font-weight: 900; font-size: 11px;">Exchange</th> 	        
            <th style="color: #000000; text-align: left; font-family: Arial, Helvetica ; font-weight: 900; font-size: 11px;">EquityName</th>
            <th style="color: #000000; text-align: right; font-family: Arial, Helvetica ; font-weight: 900; font-size: 11px;">BeginPrice</th>
            <th style="color: #000000; text-align: right; font-family: Arial, Helvetica ; font-weight: 900; font-size: 11px;">EndPrice</th>
            <th style="color: #000000; text-align: right; font-family: Arial, Helvetica ; font-weight: 900; font-size: 11px;">Difference</th>
            <th style="color: #000000; text-align: right; font-family: Arial, Helvetica ; font-weight: 900; font-size: 11px;">Change</th>
        </tr>
    </xsl:template>
     
    <xsl:template match="Record">
        <tr>
            <xsl:if test="Difference &lt; 0">
                <xsl:attribute name="style">
                    <xsl:text>color: #990000;</xsl:text>
                </xsl:attribute>
            </xsl:if>
            <xsl:if test="Difference &gt; 0">
                <xsl:attribute name="style">
                    <xsl:text>color: #006B00;</xsl:text>
                </xsl:attribute>
            </xsl:if> 	
            
            <td><xsl:value-of select="Symbol"/></td>
            
            <td><xsl:value-of select="Exchange"/></td>
               
            <td><xsl:value-of select="EquityName"/></td>
             
            <td style="text-align: right;">
            <xsl:value-of select="format-number(BeginPrice, '#.00')"/></td>
             
            <td style="text-align: right; format-number(. , '#.00')">
            <xsl:value-of select="format-number(EndPrice, '#.00')"/></td>
                         
            <td style="text-align: right; format-number(. , '#.00')">
            <xsl:value-of select="format-number(Difference, '#.00')"/></td>
             
            <td style="text-align: right; format-number(. , '#.00')">
            <xsl:value-of select="format-number(Change, '#.00')"/></td>
         </tr>
    </xsl:template>
    
</xsl:stylesheet>

Open in new window

The problem is around Line 483 where it says-

<xsl:when test="($first + $page) > {$cnt-records}">

It does not like the variable {$cnt-records} which is calculated after every possible "select". If I substitute in the variable $page, it will run without error (but, of course, that's the wrong variable).

It also doesn't like the buttons down around Line 493. If I comment them out, the entire code runs - including the infinite "select" possibilities.

Now, Line 21 is the only place where the code "[position() >= $first] [position() < ($first + $page)" has been added. It seems to work as only 15 records are displayed. I thought that I would not add that statement to every select until I was sure you agreed with the structure of the select/sort block.

Sorry this thing is so big. But, as I say 95% of it is repetitive.

Gertone -

I don't think the problem is in the "selects". It's the cnt-records variable and the button code.
I have two comments on this stylesheet

- you could have simply avoided the repetiviness by setting a variable on top that maps between your price number and the trade-off price in the select

- variables aren't really variables in XSLT, but rather constants. The reason is that no-one garantuees how the programm flows. So you can't just set a variable in one scope and use it in another.
in this piece of XSLT
           <xsl:when test="$price='All' and $sort ='EquityName' and $sector='ALL'">
               <xsl:apply-templates select="Record[Exchange !='XXXX'] [EndPrice > '10.00'] [position() >= $first] [position() < ($first + $page)]">
               <xsl:sort select="EquityName" data-type="text" order="ascending"/>
               </xsl:apply-templates>
               <xsl:variable name="cnt-records" select="count(//Record[Exchange!='XXXX'])"/>
           </xsl:when>
$cnt-records will not exist outside the xsl:when, because it is local to that scope.

So, you can only set cnt-records at the top of your stylesheet, which isn't hard to do
If you start your stylesheet like this,
there is a lot of th erepetition you can throw away
and you would be able to use $cnt-records anywhere in your stylesheet
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:output indent="yes" method="html"/>
    <xsl:param name="price">All</xsl:param>
    <xsl:param name="sector">All</xsl:param>
    <xsl:param name="sort">EquityName</xsl:param>
    <xsl:param name="first">1</xsl:param>
    <xsl:param name="page">15</xsl:param>
    
    <xsl:variable name="cnt-records">
        <xsl:choose>
            <xsl:when test="$sector = 'All'">
                <xsl:value-of select="count(//Record)"/>
            </xsl:when>
            <xsl:otherwise>
                <xsl:value-of select="count(//Record[Exchange = $sector])"/>
            </xsl:otherwise>
        </xsl:choose>
      </xsl:variable>
   

Open in new window

If you now added two extra variables at the global level

    <xsl:variable name="low-price-level">
        <xsl:choose>
            <xsl:when test="$price = 'All'">00.00</xsl:when>
            <xsl:when test="$price = '49'">00.00</xsl:when>
            <xsl:when test="$price = '99'">00.50</xsl:when>
            <xsl:when test="$price = '999'">01.00</xsl:when>
            <xsl:when test="$price = '1000'">10.00</xsl:when>
        </xsl:choose>
    </xsl:variable>
   
    <xsl:variable name="high-price-level">
        <xsl:choose>
            <xsl:when test="$price = 'All'">99999999999999999999999999999999.99</xsl:when>
            <xsl:when test="$price = '49'">00.49</xsl:when>
            <xsl:when test="$price = '99'">00.99</xsl:when>
            <xsl:when test="$price = '999'">09.99</xsl:when>
            <xsl:when test="$price = '1000'">99999999999999999999999999999999.99</xsl:when>
        </xsl:choose>
    </xsl:variable>

you can drop most of the when clauses and use an apply templates like this (when sector is not equal to 'All')

               <xsl:apply-templates select="Record[Exchange = $sector][EndPrice > $low-price-level][EndPrice < $high-price-level][position() >= $first] [position() < ($first + $page)]">

or when $sector = 'All'
               <xsl:apply-templates select="Record[EndPrice > $low-price-level][EndPrice < $high-price-level][position() >= $first] [position() < ($first + $page)]">

I think this action will take away somewhere between 300 and 400 lines from your code
I strongly recommend that you follow this route, because the tests that you had for the price level allready contained errors and will be a hell to debug



Gertone -

I understand your observations about scope.

However, the only way I'm going to come up with an accurate count of the number of records is to test 4 possible sectors (ALL, AMEX, NASDAQ & NYSE)  x 5 possible share price ranges - for a total of 20 permutations. This I can do.

Then I would run through the same 20 permutations again to do the actual selects. And, another 3 possible conditions for the actual sort sequence.

Is this what you want me to do?
OK, now I see, you also need the price levels in the cnt-records, please note my comment about the low and high price variables.
That would mean that the count variable would look like this
and should be created after the price level variables

This will bring your selects down to two permutations multiplied by three for the sort
    <xsl:variable name="cnt-records">
        <xsl:choose>
            <xsl:when test="$sector = 'All'">
                <xsl:value-of select="count(//Record[EndPrice > $low-price-level][EndPrice < $high-price-level])"/>
            </xsl:when>
            <xsl:otherwise>
                <xsl:value-of select="count(//Record[Exchange = $sector][EndPrice > $low-price-level][EndPrice < $high-price-level][)"/>
            </xsl:otherwise>
        </xsl:choose>
      </xsl:variable>

Open in new window

Gertone -

I'm afraid you're leaving me in the dust. Conceptually, I think I understand what you're saying. But, as far as writing this new code, I am at a loss.

Conceptually, all I am saying is that you can avoid all this when:clauses by setting the conditions in a global variable
and use the variable down the stylesheet
So you would create more general apply-templates, but have variable values in there

I will try to past the idea in the XSLT you sent
Gosh I don't know what I'd do without you.
Gertone -

Here is the latest. Unfortunately, it doesn't run.

Am I on ther right track. I think I need a copy of Oxygen.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:output indent="yes" method="html"/>
    <xsl:param name="price">All</xsl:param>
    <xsl:param name="sector">All</xsl:param>
    <xsl:param name="sort">EquityName</xsl:param>
    <xsl:param name="first">1</xsl:param>
    <xsl:param name="page">15</xsl:param>
   
   
    <xsl:variable name="low-price-level">
        <xsl:choose>
            <xsl:when test="$price = 'All'">00.00</xsl:when>
            <xsl:when test="$price = '49'">00.00</xsl:when>
            <xsl:when test="$price = '99'">00.49</xsl:when>
            <xsl:when test="$price = '999'">00.99</xsl:when>
            <xsl:when test="$price = '1000'">9.99</xsl:when>
        </xsl:choose>
    </xsl:variable>
    
    <xsl:variable name="high-price-level">
        <xsl:choose>
            <xsl:when test="$price = 'All'">99999999999999999999999999999999.99</xsl:when>
            <xsl:when test="$price = '49'">00.50</xsl:when>
            <xsl:when test="$price = '99'">01.99</xsl:when>
            <xsl:when test="$price = '999'">10.00</xsl:when>
            <xsl:when test="$price = '1000'">99999999999999999999999999999999.99</xsl:when>
        </xsl:choose>
    </xsl:variable>
 
   
    <xsl:variable name="cnt-records">
        <xsl:choose>
            <xsl:when test="$sector = 'All'">
                <xsl:value-of select="count(//Record/[Exchange! ="XXXX"] [EndPrice > $low-price-level][EndPrice < $high-price-level])"/>
            </xsl:when>
            <xsl:otherwise>
                <xsl:value-of select="count(//Record/[Exchange = $sector] [EndPrice > $low-price-level][EndPrice < $high-price-level])"/>
            </xsl:otherwise>
        </xsl:choose>
     </xsl:variable>
   
    <!-- Record select and sort -->
    <xsl:template match="Records">
    
    
    <table border="1" width="500" cellpadding="3" cellspacing="3">
                          
    	<xsl:call-template name="header"/>
	<xsl:choose>
		     	
	     <xsl:when test="$sort="EquityName" and $sector = 'All'"
	         <xsl:apply-templates select="Record[Exchange !='XXXX'] [EndPrice > $low-price-level][EndPrice < $high-price-level] [position() &lt; ($first + $page)]">
	         <xsl:sort select="EquityName" data-type="text" order="ascending"/>
	         </xsl:apply-templates>
	     </xsl:when>
	   
	     <xsl:when test="$sort="EquityName" and $sector != 'All'"
	         <xsl:apply-templates select="Record[Exchange = $sector] [EndPrice > $low-price-level][EndPrice < $high-price-level] [position() &lt; ($first + $page)]">
	         <xsl:sort select="EquityName" data-type="text" order="ascending"/>
	         </xsl:apply-templates>
	     </xsl:when> 
	   
	     <xsl:when test="$sort="EndPrice" and $sector = 'All'"
	         <xsl:apply-templates select="Record[Exchange !='XXXX'] [EndPrice > $low-price-level][EndPrice < $high-price-level] [position() &lt; ($first + $page)]">
	         <xsl:sort select="EndPrice" data-type="number" order="descending"/>
	         </xsl:apply-templates>
	     </xsl:when>
	   
	     <xsl:when test="$sort="EndPrice" and $sector != 'All'"
	         <xsl:apply-templates select="Record[Exchange = $sector] [EndPrice > $low-price-level][EndPrice < $high-price-level] [position() &lt; ($first + $page)]">
	         <xsl:sort select="EndPrice" data-type="number" order="descending"/>
	         </xsl:apply-templates>
	     </xsl:when>	
	   
	   
	     <xsl:when test="$sort="Change" and $sector = 'All'"
	         <xsl:apply-templates select="Record[Exchange !='XXXX'] [EndPrice > $low-price-level][EndPrice < $high-price-level] [position() &lt; ($first + $page)]">
	         <xsl:sort select="Change" data-type="number" order="descending"/>
	         </xsl:apply-templates>
	     </xsl:when>
	   
	     <xsl:when test="$sort="Change" and $sector != 'All'"
	         <xsl:apply-templates select="Record[Exchange = $sector] [EndPrice > $low-price-level][EndPrice < $high-price-level] [position() &lt; ($first + $page)]">
	         <xsl:sort select="Change" data-type="number" order="descending"/>
	         </xsl:apply-templates>
	     </xsl:when>	
	     
	</xsl:choose>     
	<th STYLE="bgcolor:#d4d0c8"> </th>
		
	</table>
	
	
	<div>
	<xsl:variable name="new-first-p">
                <xsl:choose>
                    <xsl:when test="($first - $page - 1) > 1">
                    <xsl:value-of select="$first - $page - 1"/>
                    </xsl:when>
                    <xsl:otherwise>1
                    </xsl:otherwise>
                </xsl:choose>
        </xsl:variable>
        <xsl:variable name="new-first-n">
                <xsl:choose>
                    <xsl:when test="($first + $page) > $cnt-records">
                    <xsl:value-of select="$first"/>
                    </xsl:when>
                    <xsl:otherwise>
                    <xsl:value-of select="$first + $page"/>
                    </xsl:otherwise>
                </xsl:choose>
        </xsl:variable>
  
  	<!-- Navigation Buttons
        <button type="SUBMIT" name="Previous" value="Previous" onClick="TransF({$price}, {$sector}, {$sort), {$new-first-p} ,{$page});">Previous</button>
        <button type="SUBMIT" name="Next" value="Next" onClick="TransF({$price}, {$sector}, {$sort), {$new-first-n}, {$page});">Next</button>
         -->   
  
	
	</div>
	
	   	    
    </xsl:template>
    
       
    <!-- Header row templates -->
    <xsl:template name="header">
        <tr>
            <th style="color: #000000; text-align: left; font-family: Arial, Helvetica ; font-weight: 900; font-size: 11px;">Symbol</th>	
	    <th style="color: #000000; text-align: left; font-family: Arial, Helvetica ; font-weight: 900; font-size: 11px;">Exchange</th> 	        
            <th style="color: #000000; text-align: left; font-family: Arial, Helvetica ; font-weight: 900; font-size: 11px;">EquityName</th>
            <th style="color: #000000; text-align: right; font-family: Arial, Helvetica ; font-weight: 900; font-size: 11px;">BeginPrice</th>
            <th style="color: #000000; text-align: right; font-family: Arial, Helvetica ; font-weight: 900; font-size: 11px;">EndPrice</th>
            <th style="color: #000000; text-align: right; font-family: Arial, Helvetica ; font-weight: 900; font-size: 11px;">Difference</th>
            <th style="color: #000000; text-align: right; font-family: Arial, Helvetica ; font-weight: 900; font-size: 11px;">Change</th>
        </tr>
    </xsl:template>
     
    <xsl:template match="Record">
        <tr>
            <xsl:if test="Difference &lt; 0">
                <xsl:attribute name="style">
                    <xsl:text>color: #990000;</xsl:text>
                </xsl:attribute>
            </xsl:if>
            <xsl:if test="Difference &gt; 0">
                <xsl:attribute name="style">
                    <xsl:text>color: #006B00;</xsl:text>
                </xsl:attribute>
            </xsl:if> 	
            
            <td><xsl:value-of select="Symbol"/></td>
            
            <td><xsl:value-of select="Exchange"/></td>
               
            <td><xsl:value-of select="EquityName"/></td>
             
            <td style="text-align: right;">
            <xsl:value-of select="format-number(BeginPrice, '#.00')"/></td>
             
            <td style="text-align: right; format-number(. , '#.00')">
            <xsl:value-of select="format-number(EndPrice, '#.00')"/></td>
                         
            <td style="text-align: right; format-number(. , '#.00')">
            <xsl:value-of select="format-number(Difference, '#.00')"/></td>
             
            <td style="text-align: right; format-number(. , '#.00')">
            <xsl:value-of select="format-number(Change, '#.00')"/></td>
         </tr>
    </xsl:template>
    
</xsl:stylesheet>

Open in new window

well, this required some typo-fixing
(a lot of typo-fixing :-)
Yes, you should not do this without a copy of Oxygen
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:output indent="yes" method="html"/>
    <xsl:param name="price">999</xsl:param>
    <xsl:param name="sector">All</xsl:param>
    <xsl:param name="sort">EquityName</xsl:param>
    <xsl:param name="first">1</xsl:param>
    <xsl:param name="page">15</xsl:param>
    
    
    <xsl:variable name="low-price-level">
        <xsl:choose>
            <xsl:when test="$price = 'All'">00.00</xsl:when>
            <xsl:when test="$price = '49'">00.00</xsl:when>
            <xsl:when test="$price = '99'">00.49</xsl:when>
            <xsl:when test="$price = '999'">00.99</xsl:when>
            <xsl:when test="$price = '1000'">9.99</xsl:when>
        </xsl:choose>
    </xsl:variable>
    
    <xsl:variable name="high-price-level">
        <xsl:choose>
            <xsl:when test="$price = 'All'">99999999999999999999999999999999.99</xsl:when>
            <xsl:when test="$price = '49'">00.50</xsl:when>
            <xsl:when test="$price = '99'">01.99</xsl:when>
            <xsl:when test="$price = '999'">10.00</xsl:when>
            <xsl:when test="$price = '1000'">99999999999999999999999999999999.99</xsl:when>
        </xsl:choose>
    </xsl:variable>
    
    
    <xsl:variable name="cnt-records">
        <xsl:choose>
            <xsl:when test="$sector = 'All'">
                <xsl:value-of select="count(//Record[Exchange != 'XXXX'][EndPrice > $low-price-level][EndPrice &lt; $high-price-level])"/>
            </xsl:when>
            <xsl:otherwise>
                <xsl:value-of select="count(//Record[Exchange = $sector] [EndPrice > $low-price-level][EndPrice &lt; $high-price-level])"/>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:variable>
    
    <!-- Record select and sort -->
    <xsl:template match="Records">
        
        
        <table border="1" width="500" cellpadding="3" cellspacing="3">
            
            <xsl:call-template name="header"/>
            <xsl:choose>
                
                <xsl:when test="$sort = 'EquityName' and $sector = 'All'">
                    <xsl:apply-templates select="Record[Exchange !='XXXX'][EndPrice > $low-price-level][EndPrice &lt; $high-price-level][position() &lt; ($first + $page)]">
                        <xsl:sort select="EquityName" data-type="text" order="ascending"/>
                    </xsl:apply-templates>
                </xsl:when>
                
                <xsl:when test="$sort = 'EquityName' and $sector != 'All'">
                    <xsl:apply-templates select="Record[Exchange = $sector] [EndPrice > $low-price-level][EndPrice &lt; $high-price-level] [position() &lt; ($first + $page)]">
                        <xsl:sort select="EquityName" data-type="text" order="ascending"/>
                    </xsl:apply-templates>
                </xsl:when> 
                
                <xsl:when test="$sort = 'EndPrice' and $sector = 'All'">
                    <xsl:apply-templates select="Record[Exchange !='XXXX'] [EndPrice > $low-price-level][EndPrice &lt; $high-price-level] [position() &lt; ($first + $page)]">
                        <xsl:sort select="EndPrice" data-type="number" order="descending"/>
                    </xsl:apply-templates>
                </xsl:when>
                
                <xsl:when test="$sort = 'EndPrice' and $sector != 'All'">
                    <xsl:apply-templates select="Record[Exchange = $sector][EndPrice > $low-price-level][EndPrice &lt; $high-price-level] [position() &lt; ($first + $page)]">
                        <xsl:sort select="EndPrice" data-type="number" order="descending"/>
                    </xsl:apply-templates>
                </xsl:when>	
                
                
                <xsl:when test="$sort = 'Change' and $sector = 'All'">
                    <xsl:apply-templates select="Record[Exchange !='XXXX'][EndPrice > $low-price-level][EndPrice &lt; $high-price-level] [position() &lt; ($first + $page)]">
                        <xsl:sort select="Change" data-type="number" order="descending"/>
                    </xsl:apply-templates>
                </xsl:when>
                
                <xsl:when test="$sort = 'Change' and $sector != 'All'">
                    <xsl:apply-templates select="Record[Exchange = $sector][EndPrice > $low-price-level][EndPrice &lt; $high-price-level] [position() &lt; ($first + $page)]">
                        <xsl:sort select="Change" data-type="number" order="descending"/>
                    </xsl:apply-templates>
                </xsl:when>	
                
            </xsl:choose>     
            <!--th STYLE="bgcolor:#d4d0c8"> </th-->
            
        </table>
        
        
        <div>
            <xsl:variable name="new-first-p">
                <xsl:choose>
                    <xsl:when test="($first - $page - 1) > 1">
                        <xsl:value-of select="$first - $page - 1"/>
                    </xsl:when>
                    <xsl:otherwise>1
                    </xsl:otherwise>
                </xsl:choose>
            </xsl:variable>
            <xsl:variable name="new-first-n">
                <xsl:choose>
                    <xsl:when test="($first + $page) > $cnt-records">
                        <xsl:value-of select="$first"/>
                    </xsl:when>
                    <xsl:otherwise>
                        <xsl:value-of select="$first + $page"/>
                    </xsl:otherwise>
                </xsl:choose>
            </xsl:variable>
            
            <h3>Navigation Buttons</h3>
            <button type="SUBMIT" name="Previous" value="Previous" onClick="TransF({$price}, {$sector}, {$sort}, {$new-first-p} ,{$page});">Previous</button>
            <button type="SUBMIT" name="Next" value="Next" onClick="TransF({$price}, {$sector}, {$sort}, {$new-first-n}, {$page});">Next</button>
        </div>
    </xsl:template>
    
    
    <!-- Header row templates -->
    <xsl:template name="header">
        <tr>
            <th style="color: #000000; text-align: left; font-family: Arial, Helvetica ; font-weight: 900; font-size: 11px;">Symbol</th>	
            <th style="color: #000000; text-align: left; font-family: Arial, Helvetica ; font-weight: 900; font-size: 11px;">Exchange</th> 	        
            <th style="color: #000000; text-align: left; font-family: Arial, Helvetica ; font-weight: 900; font-size: 11px;">EquityName</th>
            <th style="color: #000000; text-align: right; font-family: Arial, Helvetica ; font-weight: 900; font-size: 11px;">BeginPrice</th>
            <th style="color: #000000; text-align: right; font-family: Arial, Helvetica ; font-weight: 900; font-size: 11px;">EndPrice</th>
            <th style="color: #000000; text-align: right; font-family: Arial, Helvetica ; font-weight: 900; font-size: 11px;">Difference</th>
            <th style="color: #000000; text-align: right; font-family: Arial, Helvetica ; font-weight: 900; font-size: 11px;">Change</th>
        </tr>
    </xsl:template>
    
    <xsl:template match="Record">
        <tr>
            <xsl:if test="Difference &lt; 0">
                <xsl:attribute name="style">
                    <xsl:text>color: #990000;</xsl:text>
                </xsl:attribute>
            </xsl:if>
            <xsl:if test="Difference &gt; 0">
                <xsl:attribute name="style">
                    <xsl:text>color: #006B00;</xsl:text>
                </xsl:attribute>
            </xsl:if> 	
            
            <td><xsl:value-of select="Symbol"/></td>
            
            <td><xsl:value-of select="Exchange"/></td>
            
            <td><xsl:value-of select="EquityName"/></td>
            
            <td style="text-align: right;">
                <xsl:value-of select="format-number(BeginPrice, '#.00')"/></td>
            
            <td style="text-align: right; format-number(. , '#.00')">
                <xsl:value-of select="format-number(EndPrice, '#.00')"/></td>
            
            <td style="text-align: right; format-number(. , '#.00')">
                <xsl:value-of select="format-number(Difference, '#.00')"/></td>
            
            <td style="text-align: right; format-number(. , '#.00')">
                <xsl:value-of select="format-number(DeltaChange, '0.00')"/></td>
        </tr>
    </xsl:template>
    
</xsl:stylesheet>

Open in new window

By now, I really think I have material for a book, from this example :-)
Hello Gertone:

When I run this code, I can see the navigation buttons. That must mean the code is executing, but no records are displayed - just the headings and the buttons.

Since we last exchanged thoughts, I found a couple of bugs in your code and fixed them.

The code below is up to the minute. But, again it doesn't display any records.
<?xml version="1.0" encoding="UTF-8"?>
 
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:output indent="yes" method="html"/>
    <xsl:param name="price">999</xsl:param>
    <xsl:param name="sector">All</xsl:param>
    <xsl:param name="sort">EquityName</xsl:param>
    <xsl:param name="first">1</xsl:param>
    <xsl:param name="page">15</xsl:param>
   
   
    <xsl:variable name="low-price-level">
        <xsl:choose>
            <xsl:when test="$price = 'All'">00.00</xsl:when>
            <xsl:when test="$price = '49'">00.00</xsl:when>
            <xsl:when test="$price = '99'">00.49</xsl:when>
            <xsl:when test="$price = '999'">00.99</xsl:when>
            <xsl:when test="$price = '1000'">9.99</xsl:when>
        </xsl:choose>
    </xsl:variable>
    
    <xsl:variable name="high-price-level">
        <xsl:choose>
            <xsl:when test="$price = 'All'">99999999999999999999999999999999.99</xsl:when>
            <xsl:when test="$price = '49'">00.50</xsl:when>
            <xsl:when test="$price = '99'">02.00</xsl:when>
            <xsl:when test="$price = '999'">10.00</xsl:when>
            <xsl:when test="$price = '1000'">99999999999999999999999999999999.99</xsl:when>
        </xsl:choose>
    </xsl:variable>
 
   
    <xsl:variable name="cnt-records">
        <xsl:choose>
            <xsl:when test="$sector = 'All'">
                <xsl:value-of select="count(//Record[Exchange !='XXXX'] [EndPrice > $low-price-level][EndPrice &lt; $high-price-level])"/>
            </xsl:when>
            <xsl:otherwise>
                <xsl:value-of select="count(//Record[Exchange = $sector] [EndPrice > $low-price-level][EndPrice &lt; $high-price-level])"/>
            </xsl:otherwise>
        </xsl:choose>
     </xsl:variable>
   
    <!-- Record select and sort -->
    <xsl:template match="Records">
    
    
    <table border="1" width="500" cellpadding="3" cellspacing="3">
                          
    	<xsl:call-template name="header"/>
	<xsl:choose>
		     	
	     <xsl:when test="$sort='EquityName' and $sector = 'All'">
	         <xsl:apply-templates select="Record[Exchange !='XXXX'] [EndPrice > $low-price-level][EndPrice &lt; $high-price-level] [position() &lt; ($first + $page)]">
	         <xsl:sort select="EquityName" data-type="text" order="ascending"/>
	         </xsl:apply-templates>
	     </xsl:when>
	   
	     <xsl:when test="$sort='EquityName' and $sector != 'All'">
	         <xsl:apply-templates select="Record[Exchange = $sector] [EndPrice > $low-price-level][EndPrice &lt; $high-price-level] [position() &lt; ($first + $page)]">
	         <xsl:sort select="EquityName" data-type="text" order="ascending"/>
	         </xsl:apply-templates>
	     </xsl:when> 
	   
	     <xsl:when test="$sort='EndPrice' and $sector = 'All'">
	         <xsl:apply-templates select="Record[Exchange !='XXXX'] [EndPrice > $low-price-level][EndPrice &lt; $high-price-level] [position() &lt; ($first + $page)]">
	         <xsl:sort select="EndPrice" data-type="number" order="descending"/>
	         </xsl:apply-templates>
	     </xsl:when>
	   
	     <xsl:when test="$sort='EndPrice' and $sector != 'All'">
	         <xsl:apply-templates select="Record[Exchange = $sector] [EndPrice > $low-price-level][EndPrice &lt; $high-price-level] [position() &lt; ($first + $page)]">
	         <xsl:sort select="EndPrice" data-type="number" order="descending"/>
	         </xsl:apply-templates>
	     </xsl:when>	
	   
	   
	     <xsl:when test="$sort='Change' and $sector = 'All'">
	         <xsl:apply-templates select="Record[Exchange !='XXXX'] [EndPrice > $low-price-level][EndPrice &lt; $high-price-level] [position() &lt; ($first + $page)]">
	         <xsl:sort select="Change" data-type="number" order="descending"/>
	         </xsl:apply-templates>
	     </xsl:when>
	   
	     <xsl:when test="$sort='Change' and $sector != 'All'">
	         <xsl:apply-templates select="Record[Exchange = $sector] [EndPrice > $low-price-level][EndPrice &lt; $high-price-level] [position() &lt; ($first + $page)]">
	         <xsl:sort select="Change" data-type="number" order="descending"/>
	         </xsl:apply-templates>
	     </xsl:when>	
	     
	</xsl:choose>     
	<!--
	<th STYLE="bgcolor:#d4d0c8"></th>
	-->
		
	</table>
	
	
	<div>
	<xsl:variable name="new-first-p">
                <xsl:choose>
                    <xsl:when test="($first - $page - 1) > 1">
                    <xsl:value-of select="$first - $page - 1"/>
                    </xsl:when>
                    <xsl:otherwise>1
                    </xsl:otherwise>
                </xsl:choose>
        </xsl:variable>
        <xsl:variable name="new-first-n">
                <xsl:choose>
                    <xsl:when test="($first + $page) > $cnt-records">
                    <xsl:value-of select="$first"/>
                    </xsl:when>
                    <xsl:otherwise>
                    <xsl:value-of select="$first + $page"/>
                    </xsl:otherwise>
                </xsl:choose>
        </xsl:variable>
  
  	<h3>Navigation Buttons</h3>
        <button type="SUBMIT" name="Prev" value="Prev" onClick="TransF({$price}, {$sector}, {$sort}, {$new-first-p} ,{$page});">Prev</button>
        <button type="SUBMIT" name="Next" value="Next" onClick="TransF({$price}, {$sector}, {$sort}, {$new-first-n}, {$page});">Next</button>
           
  
	
	</div>
	
	   	    
    </xsl:template>
    
       
    <!-- Header row templates -->
    <xsl:template name="header">
        <tr>
            <th style="color: #000000; text-align: left; font-family: Arial, Helvetica ; font-weight: 900; font-size: 11px;">Symbol</th>	
	    <th style="color: #000000; text-align: left; font-family: Arial, Helvetica ; font-weight: 900; font-size: 11px;">Exchange</th> 	        
            <th style="color: #000000; text-align: left; font-family: Arial, Helvetica ; font-weight: 900; font-size: 11px;">EquityName</th>
            <th style="color: #000000; text-align: right; font-family: Arial, Helvetica ; font-weight: 900; font-size: 11px;">BeginPrice</th>
            <th style="color: #000000; text-align: right; font-family: Arial, Helvetica ; font-weight: 900; font-size: 11px;">EndPrice</th>
            <th style="color: #000000; text-align: right; font-family: Arial, Helvetica ; font-weight: 900; font-size: 11px;">Difference</th>
            <th style="color: #000000; text-align: right; font-family: Arial, Helvetica ; font-weight: 900; font-size: 11px;">Change</th>
        </tr>
    </xsl:template>
     
    <xsl:template match="Record">
        <tr>
            <xsl:if test="Difference &lt; 0">
                <xsl:attribute name="style">
                    <xsl:text>color: #990000;</xsl:text>
                </xsl:attribute>
            </xsl:if>
            <xsl:if test="Difference &gt; 0">
                <xsl:attribute name="style">
                    <xsl:text>color: #006B00;</xsl:text>
                </xsl:attribute>
            </xsl:if> 	
            
            <td><xsl:value-of select="Symbol"/></td>
            
            <td><xsl:value-of select="Exchange"/></td>
               
            <td><xsl:value-of select="EquityName"/></td>
             
            <td style="text-align: right;">
            <xsl:value-of select="format-number(BeginPrice, '#.00')"/></td>
             
            <td style="text-align: right; format-number(. , '#.00')">
            <xsl:value-of select="format-number(EndPrice, '#.00')"/></td>
                         
            <td style="text-align: right; format-number(. , '#.00')">
            <xsl:value-of select="format-number(Difference, '#.00')"/></td>
             
            <td style="text-align: right; format-number(. , '#.00')">
            <xsl:value-of select="format-number(Change, '#.00')"/></td>
         </tr>
    </xsl:template>
    
</xsl:stylesheet>

Open in new window

I see that you changed some stuff in the record section again,
so I assume that the file I use for the source is no longer equal to your source XML
(can you post your latest version please?)
eg <DeltaChange> seems to have become <Change>

In my test, with your settings (price:999, sort by equityname) I get two records in return
maybe there is an issue in your html file
(have you defined the function TransF() correctly?
Hello Gertone:

The code above is the most recent XSL.

The field Change has been "Change" for almost a week. You are correct that price:999 will display two records, but the value passed thru should initially be "All". TransF() shouldn't be a problem.

I can send you the three files making up the application.
If I set the price to All, I get 15 records showing
I think you should send me your current three files that make up the application
Hello Gertone:

I sent you my application. Outlook said that some of these files may not be deliverable due to security factors. All the files are valid, though, Gert.

Do these data files help you? If you re-posted the XSL file that works at your end, I have a file comparison utility to check it out against what I've got.

Gordo
did you send to the email address on my profile?
I have not received it yet.
It is advisable that you package in a zip if possible
I did send it to your email address. I did not zip it, though.

Let's see if you receive anything workable. If not, I can g o back and zip it.
This question must take the prize for "the most communication inspired".
you are about to enter my top 10 of longest questions, indeed :-)
Still have not received anything,
I think it is better to zip the package, I think there is a firewall in between that is not too fond of xml files
maybe you can send a message first without attachments, to see that you got the email address right
(you can replace "info" by "geert" that works as well, [dot] needs to be a "." of course and [at] needs to be a "@")
Gertone: I just sent you a zip.
Gertone:

Can you post the latest version you have of my XSL?

Gordo
Gertone:

I hope you received my zipped package. You may want to open devBlock.htm and do a global replace on \equity07 to make it \equity08. I think this might be a problem for you if you don't check this because the app will be looking in a non-existing directory for certain supporting files.
what a mess...
have not received anything yet,
can you add a .txt to each filename and post it here, or find an ftp and post it there?
Shall I try the info@  email address? There is no possible way that this could have gotten fouled up because I pressed the "Reply" to the message I originally received from you.

It seems that I can receive your messages, but you can't receive mine. Very strange.

How about re-posting your version of my XSL file?

I just tried the second alternative address.
I have tried all addresses you gave me - some just by hitting the reply button. In every case, I just sent a message (no attached zip file). If none of my messages are getting through, it can't be a filter. We are only talking about 200 ASCII characters here. Do you have problems receiving other messages from the USA?

As requested, I'll try again. By the way, LUXSCI is a big email provider run by a fellow from MIT. There should be no doubt about their credentials.
I've been getting no "undeliverable messages" being sent back to me.

I just re-mailed two of the addresses you provided.
now I am worried, and you should look whether things have left your SMTP server.
the krista... address that I gave you is on a completely different server, outside my office, different ISP
and I access it through webmail. Nothing found there either
I think it is safe to say that they are hanging somewhere in between, if not at your end
Gertone:

I called my email provider. They say that your server has received the email I sent. However, it may be getting hung up from there to your mailbox.

Also, they mailed your "preferred" address and got a message back from you saying that you did receive it. So, the mail seems to be arriving at your end.
I am in contact with them, this is all so scarry...
Can you in the mean time try the FTP route?
Gertone:
I have just discovered that I have a problem sending email to anyone. I am working on the problem.
Hi Gordon,
I am afraid that the problem is in the javascript.
The function must be in error when calling, since there seems nothing wrong with the XSLT.

Are you sure you pass 'All' correctly as a parameter?
I don't think so... since the XSLT works outside, isolated, but not when you call it from the javascript
Let me study it.
The problem was in the spelling of ALL for the "sector" variable. I changed the variable to "All" and the code worked.

The problem remaining is to get the PAGE to go to page 2 and then back to page 1.

However, before we get into that. Let me terminate this question by thanking you for all your help and awarding you the points you rightly deserve. So, we don't execeed the capacity of this system - let me open the next stage of this dialog as a new question. Please follow me to that question.

Gordo

welcome Gordon,
I will have a look at that follow up, later today