|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: XSL Decending Order Query
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








