This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: XSL Sort and Xalan
- To: <xsl-list at mulberrytech dot com>
- Subject: Re: XSL Sort and Xalan
- From: "Bryce Wells" <bryce at impulseradio dot com>
- Date: Thu, 3 Aug 2000 16:25:09 -0500
- References: <3.0.1.32.20000803201245.00968380@localhost>
- Reply-To: xsl-list at mulberrytech dot com
Jeni,
The problem, perhaps, is that I'm not storing the data that way? - let me
elaborate.
Here's my XML file:
<OBJECT_TABLE>
<RECORD>
<ID>001</ID>
<TIME>06:00:00</TIME>
<LENGTH>1:35</LENGTH>
<DESCRIPTION>CCC Record</DESCRIPTION>
</RECORD>
</OBJECT_TABLE>
Using the following XSL, I am rendering this data into an HTML table:
<table>
<xsl:for-each select="OBJECT_TABLE">
<xsl:sort select="RECORD/TIME" order="ascending"/>
<tr>
<xsl:for-each select="RECORD">
<xsl:for-each select="ID">
<td><input type="checkbox" name="arrSelect"
value="{.}"/></td>
</xsl:for-each>
<xsl:for-each select="TIME">
<td><xsl:value-of select="."/></td>
</xsl:for-each>
<xsl:for-each select="LENGTH">
<td><xsl:value-of select="."/></td>
</xsl:for-each>
<xsl:for-each select="DESCRIPTION">
<td><xsl:value-of select="."/></td>
</xsl:for-each>
</xsl:for-each>
</tr>
</xsl:for-each>
</table>
Which looks roughly like this and is sorted, correctly, by TIME
[] 06:00:00 1:35 CCC Record
[] 06:01:35 2:00 AAA Record
[] 06:03:35 3:33 BBB Record
and so forth . .
But, I would like the end-user to be able to sort this data in the HTML
page, without making another call to the database (which is generating the
XML) - and was hoping to accomplish this by creating a parameter that would
trigger the proper column to sort.
So, I created the parameter and gave it a static value (I'll pass them
dynamically later)
<xsl:param name="item" select="'RECORD/LENGTH'"/>
and I can get that value to show on my HTML page using:
<xsl:value-of select="$item"/>
but what I cannot do is:
<table>
<xsl:for-each select="OBJECT_TABLE">
<xsl:sort select="$item" order="ascending"/>
<tr> . . .
Any additional insights would be greatly appreciated.
Thanks,
Bryce
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list