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

RE: sorting based on a variable

Subject: RE: sorting based on a variable
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Tue, 12 Nov 2002 15:31:53 -0000
RE:  sorting based on a variable
try data[number($column)]

Perhaps your $column variable is a string or a result tree fragment, not
a number. You didn't show us its declaration.

Michael Kay
Software AG
home: Michael.H.Kay@xxxxxxxxxxxx
work: Michael.Kay@xxxxxxxxxxxxxx 

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of 
> Kasper Nielsen
> Sent: 12 November 2002 14:34
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  sorting based on a variable
> 
> 
> hi (another question)
> 
> lets say I want to some data for the $column data-column
> 
> <projects>
>   <project name="a">
>     <data> 1237</data>
>     <data> 1234</data>
>     <data> 1235</data>
>     <data> 1236</data>
>   </project>
>   <project name="b">
>     <data> 12</data>
>     <data> 41234</data>
>     <data> 51235</data>
>     <data> 71236</data>
>   </project>
>   <project name="c">
>     <data> 1</data>
>     <data> 41234</data>
>     <data> 51235</data>
>     <data> 71236</data>
>   </project>
> </projects>
> 
> so if $column=1 then it would sort them into {project 
> name="c", project name="b", project name="a"} however i've 
> tried <xsl:for-each select="projects/project">
>     <xsl:sort select="./data[$column]" data-type="number"/>
> but it doesn't work?
> however if just use something like
>     <xsl:sort select="./data[1]" data-type="number"/> it works fine
> 
> anyone can tell me what im doing wrong?
> 
> regards
>   Kasper Nielsen
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 


 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.