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

Re: XSL Decending Order Query

Subject: Re: XSL Decending Order Query
From: Mitch Amiano <mitch.amiano@xxxxxxxxxxxxxxxxxxxx>
Date: Sun, 03 Nov 2002 18:41:18 -0500
decending order
The sort element shouldn't contain your table elements: it should be empty. It is used to specify the sorting information and doesn't have contents. The content
should nest within the for-each only.


For sorting, you specify a string expression that turns some input in your source document into a sortable string. Typically it would be an XPath to a child element with text content, or an attribute. Remember too that for-each changes what "." means.

Refer to this template. It may or may not work for your XML input (particularly depending on whether the date element is formatted conveniently), but should at least show you how you might change your own stylesheet.

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

<xsl:output method="text"/>

<xsl:template match="/">
By Title, descending:

   <xsl:for-each select="archive/news">
   <xsl:sort select="article" order="descending"/>
      <xsl:value-of select="title"/>
   </xsl:for-each>

By Date, descending:
<xsl:for-each select="archive/news">
<xsl:sort select="date" order="descending"/>
<xsl:value-of select="date"/>, <xsl:value-of select="title"/>
</xsl:for-each>


</xsl:template>

</xsl:stylesheet>


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.