|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Simple Sort Problem
I've seen other posts about sorting issues with Xalan, but nothing
seemed to cover this simple issue. (or at least I think its simple)
I have sample xml and xsl file. In the style-sheet I am attempting to sort the result of the 'info' element according to the number in the 'date' element. In XMLspy this sort works correctly, but when I deploy it on Unix with Apache Xalan it fails to return the document in a sorted fashion; instead it just returns it in the order found in the xml. Here is the XML and the style-sheet. ------------------------------------------------------------ <?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="application/xml" href="C:\Program Files\Altova\XML Spy Suite\Examples\tran.xsl"?> <HelloWorld> <Row> <info xmlns:src="http://xml.apache.org/xindice/Query" src:col="/db/Publications/NewsGazette/News" src:key="255459967.xml"> <title>Three test2.rtf</title> <subject>School capacity could dictate growth</subject> <author>Sylvia L. Oliande</author> <date timestamp="1">1</date> </info> </Row> <Row> <info xmlns:src="http://xml.apache.org/xindice/Query" src:col="/db/Publications/NewsGazette/News" src:key="255459968.xml"> <title>Two test2.rtf</title> <subject>School capacity could dictate growth</subject> <author>Sylvia L. Oliande</author> <date timestamp="2">2</date> </info> </Row> <Row> <info xmlns:src="http://xml.apache.org/xindice/Query" src:col="/db/Publications/NewsGazette/News" src:key="255459969.xml"> <title>One test2.rtf</title> <subject>School capacity could dictate growth</subject> <author>Sylvia L. Oliande</author> <date timestamp="3">3</date> </info> </Row> <Row> <info xmlns:src="http://xml.apache.org/xindice/Query" src:col="/db/Publications/NewsGazette/News" src:key="32434578.xml"> <title>test2.rtf</title> <subject>School capacity could dictate growth</subject> <author>Sylvia L. Oliande</author> <date timestamp="4">4</date> </info> </Row> </HelloWorld> ------------------------------------------------------------------------ ---------------------------- <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:src="http://xml.apache.org/xindice/Query"> <xsl:template match="Row"> <xsl:if test="info" > <xsl:apply-templates select="info"> <xsl:sort select="info/date" order="descending"/> </xsl:apply-templates> </xsl:if> </xsl:template> <xsl:template match="/HelloWorld"> <xsl:apply-templates select="Row" /> </xsl:template> <xsl:template match="info"> <div id="date"><xsl:value-of select="date/@timestamp"/></div> <b><xsl:value-of select="title"/></b> - <xsl:value-of select="subject"/><br/> </xsl:template> </xsl:stylesheet> Thanks for help! 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








