[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Q on <xsl:sort>

Subject: RE: Q on <xsl:sort>
From: Dan Diebolt <dandiebolt@xxxxxxxxx>
Date: Wed, 2 May 2001 17:17:09 -0700 (PDT)
timestamp unix
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.