This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
xslt sorting
- To: xsl-list at mulberrytech dot com
- Subject: xslt sorting
- From: "Kari M. Scott" <kmscott at pandora dot binc dot net>
- Date: Mon, 6 Mar 2000 10:20:57 -0600 (CST)
- Reply-To: xsl-list at mulberrytech dot com
Hi,
I'm trying to get xsl:sort to work. I'm using Cocoon and its built in
xslt processor and the W3C's XSLT sort example. The data is presented
nicely on the page, but not in the correct order. Following are my xsl
and xml files. Thanks in advance for any help.
-Kari
________________________XSL file________________________
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="content">
<xsl:processing-instruction
name="cocoon-format">type="text/html"</xsl:processing-instruction>
<html>
<head>
<title>Sort Example</title>
</head>
<body bgcolor="#FFFFFF">
<h3>Sort Example</h3>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>
<xsl:template match="employees">
<ul>
<xsl:apply-templates select="employee">
<xsl:sort select="name/family"/>
<xsl:sort select="name/given"/>
</xsl:apply-templates>
</ul>
</xsl:template>
<xsl:template match="employee">
<li>
<xsl:value-of select="name/given"/>
<xsl:value-of select="name/family"/>
</li>
</xsl:template>
</xsl:stylesheet>
_______________________________XML file_____________________
<?xml version="1.0"?>
<?cocoon-process type="xslt"?>
<?xml-stylesheet href="sort.xsl" type="text/xsl"?>
<content>
<employees>
<employee>
<name>
<given>Zoe </given>
<family>Zeldman</family>
</name>
</employee>
</employees>
<employees>
<employee>
<name>
<given>Kari </given>
<family>Scott</family>
</name>
</employee>
</employees>
Kari M. Scott
Berbee
5520 Research Park Drive
Madison, WI 53711-5377
kmscott@berbee.com
608.288.3000 ext. 1223
608.298.1223 direct dial
608.288.3037 fax
Berbee...putting the E in business
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list