RE: param value in xsl:sort

Subject: RE: param value in xsl:sort
From: Kay Michael <Michael.Kay@xxxxxxx>
Date: Mon, 25 Sep 2000 13:48:58 -0400 (EST)
> I'm trying to use the value of a parameter as the select value of an
> xsl:sort element.

You can't (this is a FAQ). <xsl:sort select="$param"/> means "sort by the
value of the parameter", which, since the parameter has the same value for
every member of the node-set, is the same as saying don't sort at all. There
is no way in standard XSLT of saying "sort by the value of the XPath
expression represented by the string value of $param". You can do this in
Saxon by writing <xsl:sort select="saxon:evaluate($param)"/>. If $param is
always an element name, and if you are careful about namespaces, you can do
it in standard XSLT by writing <xsl:sort select="*[name()=$param]"/>

Mike Kay 

 XSL-List info and archive:

Current Thread