[xsl] Processor outputs once and then you have to reload the page.

Subject: [xsl] Processor outputs once and then you have to reload the page.
From: jdgarrett@xxxxxxxxxx
Date: Fri, 28 Jun 2002 12:09:41 -0500
(Primary) Problem:
I can get the Processor to output once by clicking
on any of the sort buttons, but then you have
to manually reload the page, to get the buttons to
make it resort again.

Anyone know what is being overlooked here ?
(Using MSXML 4.0 //  IE 6.026 // WinNT 4.0)

Please advise (anyone).
Thanks
Jim Garrett
jdgarrett@xxxxxxxxxx

====following is "process.xml" file==============================

<?xml version="1.0" encoding="windows-1252"?>
<?xml:stylesheet type="text/xsl" href="process.xsl" ?>


<Company>

	<Part date="2002_0627" time="0730">ABC123</Part>
	<Part date="2002_0628" time="1604">5555</Part>
	<Part date="2002_0627" time="1805">5623</Part>

	<Part date="2002_0625" time="1105">2546987</Part>
	<Part date="2002_0625" time="1005">1254</Part>
	<Part date="2002_0625" time="1301">99887</Part>
	<Part date="2002_0626" time="0925">99887</Part>
	<Part date="2002_0626" time="1303">1254</Part>
	<Part date="2002_0627" time="1524">889944</Part>
	<Part date="2002_0627" time="0825">005</Part>

</Company>


====following is "process.xsl" file==============================

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
  version="1.0"
  xmlns:msxsl="urn:schemas-microsoft-com:xslt"
 xmlns:jsuser="http://jscript"; >


<!-- ///////////////////////////////////  -->

<xsl:param name="param1" select="''"/>




<!-- ///////////////////////////////////  -->



<msxsl:script language="JScript" implements-prefix="jsuser">
</msxsl:script>


<!-- ///////////////////////////////////  -->



<xsl:template match="/">





<!-- ///////////////////////////////////  -->



<HTML DIR="LTR">

<HEAD>


<!-- ///////////////////////////////////  -->



<style>
.clsData0
	{
	background-color:#ccccff;
	font-family: Verdana;
	font-style:;
	font-size:8pt;
	color:#000000;
	text-decoration:none;
	font-weight:;
	cursor:hand;
	}

.clsData1
	{
	background-color:#f8cc8f;
	font-family: Verdana;
	font-style:;
	font-size:8pt;
	color:#000000;
	text-decoration:none;
	font-weight:;
	cursor:hand;
	}

.clsData2
	{
	background-color:#95c0ff;
	font-family: Verdana;
	font-style:;
	font-size:8pt;
	color:#000000;
	text-decoration:none;
	font-weight:;
	cursor:hand;
	}

.clsData3
	{
	background-color:#77aaaa;
	font-family: Verdana;
	font-style:;
	font-size:8pt;
	color:#FFFFFF;
	text-decoration:none;
	font-weight:;
	cursor:hand;}

.clsData4
	{
	background-color:red;
	font-family: Verdana;
	font-style:;
	font-size:8pt;
	color:#FFFFFF;
	text-decoration:none;
	font-weight:;
	cursor:hand;
	}


</style>




<!-- ///////////////////////////////////  -->



 <SCRIPT>
  <xsl:comment>
    <![CDATA[

        var stylesheet = document.XSLDocument;
        var source = document.XMLDocument;

	xml  = new ActiveXObject("Msxml2.FreeThreadedDOMDocument.4.0");
	xml.async = false;
	xml.load(source);

	xsl = new ActiveXObject("Msxml2.FreeThreadedDOMDocument.4.0");
	xsl.async = false;
	xsl.load(stylesheet);


        template = new ActiveXObject("Msxml2.XSLTemplate.4.0");
	template.stylesheet = xsl;

	processor = template.createProcessor();
	processor.input = xml;

    ]]>
   </xsl:comment>
  </SCRIPT>

  <SCRIPT>
   <xsl:comment>
    <![CDATA[

	var SortOnThisField = '.';

	function WhatIsValue()
	{
		return(SortOnThisField);
	}



	function sort(field)
    	{
    		processor.readyState;
		switch(field)
		{
			case '1':
				processor.addParameter("param1", "./@date");
				SortOnThisField = './@date';
				break;

			case '2':
				processor.addParameter("param1", "./@time");
				SortOnThisField = './@time';
				break;

			case '3':
				processor.addParameter("param1", ".");
				SortOnThisField = '.';
				break;

			default:
				break;

		}

		//alert('SortOnThisField = ' + SortOnThisField);
		processor.transform()
		report.innerHTML = processor.output;
		processor.readyState;
		//processor.reset();
	    }


    ]]>
   </xsl:comment>
  </SCRIPT>

<!-- ///////////////////////////////////  -->


</HEAD>


<!-- ///////////////////////////////////  -->

<BODY leftMargin="0" topMargin="0" bgcolor="#FFFFFF" >


<div id="report">
	<xsl:apply-templates select="Company">
		<xsl:with-param name="drilldown1" select="$param1"/>
	</xsl:apply-templates>
</div>

</BODY>
</HTML>

<!-- ///////////////////////////////////  -->


</xsl:template>


<!-- ///////////////////////////////////  -->



<xsl:template match="Company">
<!--	<xsl:param name="drilldown1" select="''"/>  -->
	<xsl:param name="drilldown1" />


<button class="clsData0" onclick="sort('1')">Sort By Date</button>
<button class="clsData0" onclick="sort('2')">Sort By Time</button>
<button class="clsData0" onclick="sort('3')">Sort By PartNo</button>






<!-- ///////////////////////////////////  spacer table -->

	<TABLE border="0" cellPadding="0" cellSpacing="0" ><TR><TD
height="5"></TD></TR></TABLE>


<!-- ///////////////////////////////////  -->





<TABLE border="0" cellPadding="0" cellSpacing="0" >


	<xsl:choose>

		<xsl:when test="$drilldown1 = '.'">
			<TABLE border="0" cellPadding="0" cellSpacing="0" >
			<TR>
			<TD class="clsData1" height="15">(sorted by partno)</TD>
			</TR>
			</TABLE>

			<xsl:for-each select="Part">
				<xsl:sort select="."/>
				<xsl:call-template name="process2"/>
			</xsl:for-each>
		</xsl:when>

		<xsl:when test="$drilldown1 = './@date'">
			<TABLE border="0" cellPadding="0" cellSpacing="0" >
			<TR>
			<TD class="clsData1" height="15">(sorted by date)</TD>
			</TR>
			</TABLE>
			<xsl:for-each select="Part">
				<xsl:sort select="./@date"/>
				<xsl:call-template name="process2"/>
			</xsl:for-each>
		</xsl:when>

		<xsl:when test="$drilldown1 = './@time'">
			<TABLE border="0" cellPadding="0" cellSpacing="0" >
			<TR>
			<TD class="clsData1" height="15">(sorted by time)</TD>
			</TR>
			</TABLE>
			<xsl:for-each select="Part">
				<xsl:sort select="./@time"/>
				<xsl:call-template name="process2"/>
			</xsl:for-each>
		</xsl:when>

		<xsl:otherwise>
			<TABLE border="0" cellPadding="0" cellSpacing="0" >
			<TR>
			<TD class="clsData1" height="15">(sorted by document order)</TD>
			</TR>
			</TABLE>
			<xsl:for-each select="Part">
				<xsl:call-template name="process2"/>
			</xsl:for-each>
		</xsl:otherwise>

	</xsl:choose>

</TABLE>
</xsl:template>


<!-- ///////////////////////////////////  -->




<xsl:template name="process2" >

	<TR>
	<TD>





    <!-- begin report table  -->


       <TABLE border="0" cellPadding="0" cellSpacing="0" >
	<TR>
	<TD  class="clsData4" width="150">

       <TABLE border="0" cellPadding="0" cellSpacing="0" >
        <TR>
	<TD class="clsData4" width="5" height="15" ></TD>

	<TD class="clsData4" nowrap="">PartNo Sold = <xsl:value-of
select="."/></TD>
	<TD class="clsData4" width="5"></TD>
        </TR>
       </TABLE>

	</TD>
	<TD>

       <TABLE border="0" cellPadding="0" cellSpacing="0" >
        <TR>
	<TD class="clsData3" width="5" height="15" ></TD>
	<TD class="clsData3" align="left">Date Sold = <xsl:value-of
select="./@date"/></TD>

	<TD class="clsData3" width="10" ></TD>
	<TD class="clsData3" align="left">Time Sold = <xsl:value-of
select="./@time"/></TD>

	<TD class="clsData3" width="5"></TD>
        </TR>
       </TABLE>

	</TD>
	</TR>


	<TR>
	<TD height="5">
	</TD>
	</TR>


	</TABLE>

    <!-- end report table  -->


    </TD>
  </TR>

</xsl:template>


<!-- ///////////////////////////////////  -->


</xsl:stylesheet>


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread