Subject: RE: [xsl] Q on <xsl:sort> From: Dan Diebolt <dandiebolt@xxxxxxxxx> Date: Wed, 2 May 2001 17:17:09 -0700 (PDT) |
Simplify your problem to concentrate on what you are asking, and remove the extra junk. I created four timestamps and modified @unix and text() nodes to test the sort. Note the @unix and text() values are not derived from one from the other. Compare the sort order of the following output: 987413416002, 2001-04-16T04:30:35 987413416000, 2001-04-16T04:30:34 987413416001, 2001-04-16T04:30:33 987413416003, 2001-04-16T04:30:32 ------------------------ 987413416003, 2001-04-16T04:30:32 987413416002, 2001-04-16T04:30:35 987413416001, 2001-04-16T04:30:33 987413416000, 2001-04-16T04:30:34 Regards, Dan File: Torres2May2001.xml <?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="Torres2May2001.xsl"?> <root> <timestamp unix='987413416003'>2001-04-16T04:30:32</timestamp> <timestamp unix='987413416000'>2001-04-16T04:30:34</timestamp> <timestamp unix='987413416002'>2001-04-16T04:30:35</timestamp> <timestamp unix='987413416001'>2001-04-16T04:30:33</timestamp> </root> File: Torres2May2001.xsl <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <xsl:apply-templates select="root"/> </xsl:template> <xsl:template match="root"> <xsl:for-each select="timestamp"> <xsl:sort select="text()" data-type="text" order="descending"/> <xsl:value-of select="@unix"/>, <xsl:value-of select="text()"/><br/> </xsl:for-each> <hr/> <xsl:for-each select="timestamp"> <xsl:sort select="@unix" data-type="number" order="descending"/> <xsl:value-of select="@unix"/>, <xsl:value-of select="text()"/><br/> </xsl:for-each> </xsl:template> </xsl:stylesheet> __________________________________________________ Do You Yahoo!? Yahoo! Auctions - buy the things you want at great prices http://auctions.yahoo.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Q on <xsl:sort>, Dan Diebolt | Thread | [xsl] How does XSLT deal with inter, Frank Zhou |
Re: [xsl] Converting linebreaks, Mike Brown | Date | Re: [xsl] A probs!!, Dan Diebolt |
Month |