[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: value of xsl:param in xsl:sort

Subject: Re: value of xsl:param in xsl:sort
From: Peter Davis <pdavis152@xxxxxxxxx>
Date: Wed, 13 Feb 2002 21:22:21 -0800
value of xsl
I assume that your xsl:sort is a child of a xsl:for-each or an 
xsl:apply-templates, and that the xsl:param is a child of an xsl:template or 
the top level, and that the xsl:param and xsl:sort are not together like you 
pasted, or else your stylesheet shouldn't work at all.  If that's not the 
case, then look at that first.

The problem is that xsl:sort converts the result of its select attribute with 
the string() function and uses that as the sort key.  So what you have is 
string($sortByElement), which is the same for every element since the value 
of $sortByElement never changes.  Since all the sort keys are identical, the 
sort has no effect.

Specifying the path directly would have a different result for each element 
in the sorted list.

Unfortunately you can't use a param or variable like this, since its value 
never changes.  If you need to use a complete XPath expression dynamically, 
look for an "evaluate" extension function for your specific processor.  
Otherwise, you are stuck with matching the name of a single child element, as 
someone else posted, by doing *[name() = $sortByElement].

On Wednesday 13 February 2002 20:41, Kunal H. Parikh wrote:
> Hi !
>
> ========================
> <xsl:param name="sortByElement">AuthorList/Author/Name</xsl:param>
> <xsl:sort select="$sortByElement" order="ascending"></xsl:sort>
> ========================
>
> The above code does not seem to be replacing the $sortByElement for the
> parameter.
>
> But, if I replace "$sortByElement" with "AuthorList/Author/Name",
> everything works out just fine.
>
> Can someone please suggest what mistake I am making ?
>
>
>
> TIA,
>
> Kunal
>
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

-- 
Peter Davis
It is very difficult to prophesy, especially when it pertains to the future.

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.