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

RE: sort

Subject: RE: sort
From: Kay Michael <Michael.Kay@xxxxxxx>
Date: Thu, 11 May 2000 13:43:32 +0100
RE: sort
> I am passing a parameter using
> processor.setStylesheetParam("S", "'name'");
> 
> Now in my style sheet I can access the parameter like this
> <xsl:value-of select="$S">
> but if I try to use this
> 
> <xsl:sort select="$S"> .. it doesn't work
>
I think it does work. The value of $S is the literal value 'name', so the
sort key for each member of the set is 'name', and when all members of the
set have the same sort key they are processed in document order.

I suspect what you want to do is to sort by the value of the child element
whose name is given in $S. Subject to small print involving namespaces, you
can do this as

<xsl:sort select="*[name()=$S]"/>

This is a FAQ. Note that the solution isn't general, for example it wouldn't
allow you to pass "@code" or "price * quantity" as the value of the sort
key. For a general solution, look at the Saxon extension function
saxon:evaluate(). Another solution is to modify the stylesheet before
execution: there's an example in my book of how to do this with MSXML3.

Mike Kay


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


Current Thread
  • RE: sort
    • Kay Michael - Thu, 11 May 2000 13:43:32 +0100 <=

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.