This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Using variables in xsl:sort select attribute
- To: "XSL mailing list (E-mail)" <XSL-List at lists dot mulberrytech dot com>
- Subject: [xsl] Using variables in xsl:sort select attribute
- From: Mike McGraw <mmcgraw at 724 dot com>
- Date: Thu, 24 May 2001 12:01:50 -0400
- Reply-To: xsl-list at lists dot mulberrytech dot com
I have defined a variable called $sortby, and later in the template, wish to
display a list of elements and sort the list according to the value stored
in $sortby
...
<xsl:template match="customerList">
<xsl:variable name="sortby" select="@sortby">
<xsl:for-each select="person">
<xsl:sort select="$sortby"/>
<tr>
<td><xsl:value-of select="name" /></td>
<td><xsl:value-of select="age" /></td>
</tr>
</xsl:for-each>
</xsl:template>
...
However, this doesn't work. The parser ignores the sort instruction. Am I
permitted to use a variable as the argument for the select attribute of the
sort?
Mike
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list