This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: sort parameter problem
- To: <xsl-list at lists dot mulberrytech dot com>
- Subject: RE: [xsl] sort parameter problem
- From: "Michael Kay" <mhkay at iclway dot co dot uk>
- Date: Mon, 24 Sep 2001 18:56:27 +0100
- Reply-To: xsl-list at lists dot mulberrytech dot com
>
> The following construct hasn't any sort effect when called
> with sort=bar
> parameter:
> <xsl:template name="list-foos">
> <xsl:param name="sort"/>
> <xsl:for-each select="foos/foo">
> <xsl:sort select="$sort"/>
> [..]
> </xsl:for-each>
> </xsl:template>
It has no effect because every node has the same value of the sort key, that
is, the value of the parameter $sort.
>
> The XSL spec says:
> xsl:sort has a select attribute whose value is an expression.
>
And the sort key is the value of that expression. It's not the value of the
expression that results from evaluating the expression. In other words, the
sort key is the value of $sort, not the value of the expression contained in
$sort.
This is a FAQ. The most common circumventions are:
(a) use a construct such as select="*[name()=$name]"
(b) use saxon:evaluate() or xalan:evaluate()
(c) modify the stylesheet before use
Mike Kay
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list