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

Simple Sort Problem

Subject: Simple Sort Problem
From: Evan Borysko <evanborysko@xxxxxxxxx>
Date: Tue, 26 Nov 2002 15:00:15 -0500
simple sort
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



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.