This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: dynamic sorting
- To: <xsl-list at lists dot mulberrytech dot com>
- Subject: RE: [xsl] dynamic sorting
- From: "Max Dunn" <maxdunn at siliconpublishing dot com>
- Date: Sun, 4 Nov 2001 15:02:22 -0800
- Organization: Silicon Publishing
- Reply-To: xsl-list at lists dot mulberrytech dot com
I had no trouble saving the files or viewing source, but I put a zip
file there as well:
www.siliconpublishing.com/sortdemo.zip
Max
-----Original Message-----
From: owner-xsl-list@lists.mulberrytech.com
[mailto:owner-xsl-list@lists.mulberrytech.com] On Behalf Of Danny Guindi
Sent: Sunday, November 04, 2001 2:35 PM
To: 'xsl-list@lists.mulberrytech.com'
Subject: RE: [xsl] dynamic sorting
Thanks Max and Joerg for your replies. I do, however, have a couple
more
questions.
Max, the URLs you sent me show exactly what I want to do, but it doesn't
allow me to view the source, so I can see how JavaScript is called to
perform the sort.
Joerg, I still don't understand how parameters are passed between XML
and
XSL? Here is my simple test code, but I don't know how to make it sort.
XML
-----
<?xml version="1.0"?>
<root>
<row>
<name>test1</name>
<age>20</age>
<city>london</city>
<country>great britain</country>
</row>
<row>
<name>test2</name>
<age>40</age>
<city>new york</city>
<country>united states</country>
</row>
</root>
XSL
---
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="sort">name</xsl:param>
<xsl:template match="root">
<table border='1'>
<tr>
<th>Name</th>
<th>Age</th>
<th>City</th>
<th>Country</th>
</tr>
<xsl:apply-templates select="row">
<xsl:sort select="*[name() = $sort]"/>
</xsl:apply-templates>
</table>
</xsl:template>
<xsl:template match="row">
<tr>
<td><xsl:value-of select="name"/></td>
<td><xsl:value-of select="age"/></td>
<td><xsl:value-of select="city"/></td>
<td><xsl:value-of select="country"/></td>
</tr>
</xsl:template>
</xsl:stylesheet>
Thanks again,
Danny
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list