Subject: [xsl] order-by in WD-xsl? From: Myee.Riri@xxxxxxxxxx Date: Tue, 11 May 2004 12:57:37 +1000 |
Hi all; I have a stylesheet that uses the old namespace. To sort it uses the order-by clause. When it sorts numbers it sorts them in the following way 1 10 10 2 23 etc. When I order-by a date value it does not sort by date at all. not surprising since I am aware that xsl does not really support date sorting. But I have heard there is a way to sort by date and sort numbers correctly. Something about ascii??? I just want to know does anyone know if this is really possible in the WD-xsl namespace? I know the old namespace should be avoided, but I am not sure if the new namespace will work for all users of this application (about 400 users) since they may not have the correct parser. In which case it would cost a lot of money to install the correct parser, because we outsource that stuff to IBM. So if it possible, no parser need be installed, and I learn another new thing about xsl. I'm new to xsl so please be gentle. Thanks Myee p.s. it is coloured because I copied it from notes, just ignore colour. xsl <?xml version="1.0" ?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl" > <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" order-by="DateVal" / > </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> <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: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> <xsl:otherwise> <tr class='comments'> <td width='658' colspan="3"><hr width="90" align="left" valign ="bottom" /></td> </tr> </xsl:otherwise> </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:template> </xsl:stylesheet> here is xml file <?xml version="1.0" encoding="ISO-8859-1"?> <?xml-stylesheet type="text/xsl" href="xsl.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/05</DateVal> <TimeVal>55555</TimeVal> <EntryNo>8</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/01</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/04</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/03</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/02</DateVal> <TimeVal>33333</TimeVal> <EntryNo>5</EntryNo> <Comments>I gots something to tell ya</Comments> <EnterBy>QNAMEa</EnterBy> <EnterDate>08/05/2003</EnterDate> <Action/> <RowNo>1</RowNo> </viewentry> </viewentries> **************************************************************** NOTICE - This message is intended only for the use of the addressee named above and may contain privileged and confidential information. If you are not the intended recipient of this message you are hereby notified that you must not disseminate, copy or take any action based upon it. If you received this message in error please notify HIC immediately. Any views expressed in this message are those of the individual sender, except where the sender specifically states them to be the views of HIC. ****************************************************************
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Slightly OT: Java XPointe, Mullee, John | Thread | Re: [xsl] order-by in WD-xsl?, David Carlisle |
Re: [xsl] alphabetic counters, Nicholas Shanks | Date | Re: [xsl] problem: recursive templa, George Cristian Bina |
Month |