Hi
I have an xml file which is transformed using xsl and displayed in HTML. I am using msxml3 and IE6, with this namespace <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

My problem is sorting.

The xsl sorts the xml using values it gets from some form fields in the HTML page. The field it gets values from is called SortVal, and its value is created dynamically from a Lotus Notes document form.

SortVal contains the value to sort the xml by. In the HTML file I set the value of a <xslaram> to be the SortVal. I then use this param to determine what to sort by.

here is my xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="test11.xsl"?>
<viewentries toplevelentries="5" error="0">
<headerdata>
<State>ACT</State>
<CaseNo>CN1</CaseNo>
<From/>
<To/>
<SortBy>1</SortBy>
<SelectBy>All</SelectBy>
<srt>EntryNo</srt>
</headerdata>
<Case>
<CaseNo>CN1</CaseNo>
<SubName>Homer J Simpson</SubName>
<CaseMgr/>
<RefType>Pin</RefType>
<RefVal>000000000</RefVal>
<CaseOff>Myee Riri</CaseOff>
<OpName/>
<Entries>5</Entries>
</Case>
<viewentry position="1" noteid="docnoteid1">
<DateVal>01/02/2005</DateVal>
<TimeVal>55555</TimeVal>
<EntryNo>10</EntryNo>
<Comments>I gots something to tell ya</Comments>
<EnterBy>ANAME</EnterBy>
<EnterDate>08/05/2003</EnterDate>
<Action/>
<RowNo>1</RowNo>
</viewentry>
<viewentry position="2" noteid="docnoteid1">
<DateVal>27/02/2001</DateVal>
<TimeVal>44444</TimeVal>
<EntryNo>1</EntryNo>
<Comments>Test Comment</Comments>
<EnterBy>DNAME</EnterBy>
<EnterDate>08/05/2003</EnterDate>
<Action/>
<RowNo>2</RowNo>
</viewentry>
<viewentry position="3" noteid="docnoteid1">
<DateVal>31/12/2004</DateVal>
<TimeVal>11111</TimeVal>
<EntryNo>3</EntryNo>
<Comments>I gots something to tell ya</Comments>
<EnterBy>FNAME</EnterBy>
<EnterDate>08/05/2003</EnterDate>
<Action/>
<RowNo>4</RowNo>
</viewentry>
<viewentry position="4" noteid="docnoteid1">
<DateVal>15/09/2003</DateVal>
<TimeVal>cff</TimeVal>
<EntryNo>4</EntryNo>
<Comments>Some comments about somthing</Comments>
<EnterBy>ZNAME</EnterBy>
<EnterDate>04/05/2003</EnterDate>
<Action>Further action required goes here</Action>
<RowNo>2</RowNo>
</viewentry>
<viewentry position="5" noteid="docnoteid1">
<DateVal>28/11/2002</DateVal>
<TimeVal>33333</TimeVal>
<EntryNo>15</EntryNo>
<Comments>I gots something to tell ya</Comments>
<EnterBy>QNAMEa</EnterBy>
<EnterDate>08/05/2003</EnterDate>
<Action/>
<RowNo>1</RowNo>
</viewentry>
</viewentries>


here is my xsl
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xslaram name="sortby">DateVal</xslaram>
<xslaram name="datatype">number</xslaram>
<xsl:template match="/">
<xsl:apply-templates select="viewentries/headerdata"/>
<table class="maintable">
<tr>
<td>
<br/>
<xsl:apply-templates select="viewentries/Case"/>
<xsl:apply-templates select="viewentries/viewentry"/>
</td>
</tr>
</table>
<p>------ End of Report ------</p>
</xsl:template>
<xsl:template match="viewentries/headerdata">
<p>PRDESKTOP<br/>
<xsl:value-of select="State"/>
<xsl:value-of select="CaseNo"/>
<xsl:if test="From/text()">
From:<xsl:value-of select="From"/> To:<xsl:value-of select="To"/>
</xsl:if>
<br/>
Sorted by:<xsl:value-of select="SortBy"/> Select Option:<xsl:value-of select="SelectBy"/>
<br/>
<br/>
RUNNING SHEET REPORT</p>
</xsl:template>
<xsl:template match="viewentries/Case">
<div class="category">
<table class="standard" cellspacing="0" cellpadding="0">
<tr class="title">
<td class="titlecell" width="108">Case Number</td>
<td width="450">Subject Name</td>
</tr>
<tr class="content">
<td width="108">
<xsl:value-of select="CaseNo"/>
</td>
<td width="450">
<xsl:value-of select="SubName"/>
</td>
</tr>
</table>
<BR/>
<table class="standard" cellspacing="0" cellpadding="0">
<tr class="title">
<td class="titlecell" width="225"> Case Manager</td>
<td class="titlecell" width="180">Reference Type</td>
<td class="titlecell" width="135">Reference</td>
</tr>
<tr class="content">
<td class="titlecell" width="225">
<xsl:value-of select="CaseMgr"/>
</td>
<td class="titlecell" width="180">
<xsl:value-of select="RefType"/>
</td>
<td class="titlecell" width="135">
<xsl:value-of select="RefVal"/>
</td>
</tr>
</table>
<BR/>
<table class="standard" cellspacing="0" cellpadding="0">
<tr class="title">
<td class="titlecell" width="225">Case Officer</td>
<td class="titlecell" width="270">Operation Name</td>
<td class="titlecell" width="36"> </td>
<td class="titlecell" width="54">Entries</td>
</tr>
<tr class="content">
<td class="contentcell" width="225">
<xsl:value-of select="CaseOff"/>
</td>
<td class="contentcell" width="270">
<xsl:value-of select="OpName"/>
</td>
<td class="contentcell" width="36"/>
<td class="contentcell" width="54">
<xsl:value-of select="Entries"/>
</td>
</tr>
</table>
<BR/>
</div>
<hr width="658" align="left"/>
</xsl:template>
<xsl:template match="viewentries/viewentry">
<div class="child" id="Sheet Entry">
<table class="standard" cellspacing="0" cellpadding="0">
<xsl:if test="$sortby='DateVal'">
<xsl:value-of select="$sortby" />
<xsl:for-each select="/viewentries/viewentry">
<xsl:for-each select="DateVal">
<xsl:sort select="substring(. , 7,2)" order="ascending" data-type="number"/>
<xsl:sort select="substring(. , 4,2)" order="ascending" data-type="number"/>
<xsl:sort select="substring(. , 1,2)" order="ascending" data-type="number"/>
<xsl:value-of select="."/>
</xsl:for-each>
</xsl:for-each>
</xsl:if>
<xsl:if test="$sortby='EnterBy' ">
<xsl:value-of select="$sortby" />
<xsl:for-each select="/viewentries/viewentry">
<xsl:sort select="$sortby" data-type="text" />
</xsl:for-each>
</xsl:if>
<xsl:if test="$sortby='EntryNo'">
<xsl:value-of select="$sortby" />
<xsl:for-each select="/viewentries/viewentry">
<xsl:sort select="$sortby" data-type="number" />
</xsl:for-each>
</xsl:if>
<xsl:choose>
<xsl:when test="RowNo/text()">
<tr class="comments">
<td width="658" colspan="3">
<hr width="658" align="left" valign="bottom"/>
</td>
</tr>

</xsl:when>
<xsltherwise>
<tr class="comments">
<td width="658" colspan="3">
<hr width="90" align="left" valign="bottom"/>
</td>
</tr>
</xsltherwise>
</xsl:choose>

<tr class="title">
<td width="90">Date</td>
<td width="396" class="commentstitle">Comments</td>
<td width="153">Entered By</td>
</tr>
<tr class="content">
<td width="90">
<xsl:value-of select="DateVal"/>
</td>
<td width="396" rowspan="5" valign="top" class="comments">
<xsl:value-of select="Comments"/>
</td>
<td width="153">
<xsl:value-of select="EnterBy"/>
</td>
</tr>
<tr class="title">
<td width="90">Time</td>
<td width="153">Entered Date</td>
</tr>
<tr class="content">
<td width="90">
<xsl:value-of select="TimeVal"/>
</td>
<td width="153">
<xsl:value-of select="EnterDate"/>
</td>
</tr>
<tr class="title">
<td width="90">Entry No</td>
<td width="153">Action Req.</td>
</tr>
<tr class="content">
<td width="90">
<xsl:value-of select="EntryNo"/>
</td>
<td width="153">
<xsl:value-of select="Action"/>
</td>
</tr>
</table>
<br/>
</div>
<!-- </xsl:for-each> -->
</xsl:template>
</xsl:stylesheet>

I am not sure about the date sorting yet but the other sorting (ENntryNo and EnterBy) do not work either.

My javascript correctly changes the value of the sortby param. Everthing turns out properly, only it is not sorted. I am especially having problems with sorting by dtae (since there is no sort by date function)

Any ideas