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

RE: Parameterized sort

Subject: RE: Parameterized sort
From: Stuart Brown <sbrown@xxxxxxxxxxx>
Date: Tue, 1 Apr 2003 14:46:03 +0100
RE:  Parameterized sort
Hi Kim,

> I have the following sort problem where I want to have the 
> sort key defined 
> as a parameter.
  ...
> <document>
> <row><column name="FirstName">John</column>
>       <column name="LastName">Doo</column>
> </row>
> <row><column name="FirstName">Alice</column>
>       <column name="LastName">Mulcaster</column>
> </row>
  ...
> <xsl:sort select="column[@name=*[name()=$sortByColumn]]"/>


Your problem is that you are trying to treat the attribute value as if it
were an element, and using the wildcard and name() functions. You are
overcomplicating things: all you need to do is sort by the column element
whose name attribute value (a string) equates to the parameter (another
string); this is a simple comparison. Just try

<xsl:sort select="column[@name=$sortByColumn]"/>

Hope that helps,

Stuart

 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.