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

RE: dinamic sorting question

Subject: RE: dinamic sorting question
From: "Aniceto Lopez" <aniceto@xxxxxxxxxxxxx>
Date: Mon, 16 Dec 2002 09:33:40 +0100
xslt sort on atribute
ok Michael here are the samples

-----XML
<sites-list orderedcol="cod" order="descending" type="number">
  <site id="4" cod="100" folder-name="SI01"/>
  <site id="2" cod="0.5" folder-name="SI35"/>
  <site id="5" cod="50" folder-name="SI05"/>
  <site id="1" cod="25" folder-name="SI44"/>
  <site id="3" cod="0.25" folder-name="SI05"/>
</sites-list>


-----XSL
<xsl:variable name="queelemento" select="sites-list/@orderedcol"/>
<xsl:variable name="queorden" select="sites-list/@order"/>
<xsl:variable name="tipoelemento" select="sites-list/@type"/>

<xsl:for-each select="sites-list/site">
 <xsl:sort select="*[name()=$queelemento]" order="{$queorden}"
data-type="{$tipoelemento}"/>
 <xsl:value-of select="@id"/>,<xsl:value-of select="@cod"/>,<xsl:value-of
select="@folder-name"/><br/>
</xsl:for-each>


So "$queelemento" tells which "site"-atribute is sorting
"data-type" and "order" are working with variables but not "select"
What is wrong in my code?

thanks in advance
Aniceto Lopez




-----Mensaje original-----
De: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]En nombre de Michael Kay
Enviado el: viernes, 13 de diciembre de 2002 14:57
Para: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Asunto: RE:  dinamic sorting question


> Hi, dinamic sorting question
> after visiting dpawsosn's XSLT Questions and Jeni Tennison
> web I've found this solution to decide via variables how to sort:
>
> <xsl:sort select="*[name()=$elemento]" data-type="{$tipo}"
> order="{$orden}" />
>
> but it's not working, mabe the cause is transforming with
> Xerces2 Java Parser 2.2.1?

The cause is almost certainly in your own code, but we would need to see
more of it to help you.

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


 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.