This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: sort parameter problem


>
> 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]