473,396 Members | 2,129 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

XSL / XML Sort Problem !

Hi All,

this is a sample of my XML doc:
<nodo>
<nodo1>
<nodo11 aa="10">21</nodo11>
<nodo12>41</nodo12>
<nodo13>61</nodo13>
<nodo14>71</nodo14>
<nodo15>marco</nodo15>
</nodo1>
<nodo1>
<nodo11 aa="10">21</nodo11>
<nodo12>92</nodo12>
<nodo13>12</nodo13>
<nodo14>42</nodo14>
<nodo15>carla</nodo15>
</nodo1>
<nodo1>
<nodo11 aa="13">21</nodo11>
<nodo12>43</nodo12>
<nodo13>53</nodo13>
<nodo14>3</nodo14>
<nodo15>antonio</nodo15>
</nodo1>
<info>
<ordinamento>ascending</ordinamento>
<campo>nodo14</campo>
</info>
</nodo>

and this my XSL.. that NOT work like I want !!! :-(

<xsl:variable name="ordinamento">
<xsl:value-of select="info/ordinamento"/>
</xsl:variable>
<xsl:variable name="campo">
<xsl:value-of select="info/campo"/>
</xsl:variable>

<xsl:when test=" $campo = 'nodo12' ">
<xsl:for-each select="nodo1">
<xsl:sort select="X.??.X.??.X" order="{$ordinamento}" data-type="number" />
<xsl:call-template name="writeData"/>
</xsl:for-each>
</xsl:when>

My idea is to make DINAMIC order !
I've two variable: ordinamento to take the type
and campo to choose the node to SORT !!!
Good. But there is a "little" problem...
<xsl:sort select="$campo"... --> DON'T WORK
<xsl:sort select="{$campo}" --> DON'T WORK
but for the order.. I use order="{$ordinamento}"

WHY ?!?!?!?

Anyone can help ME !!!
Thanks
Bye
Jul 20 '05 #1
1 2033
In article <96**************************@posting.google.com >,
Marco <ne*****@tiscali.it> wrote:
<xsl:sort select="$campo"... --> DON'T WORK
<xsl:sort select="{$campo}" --> DON'T WORK


The select attribute is XPath expression, and must be static - not
something determined from the document. This is true of all XPath
expressions in XSLT 1.0.

But you can do something like this:

select="*[name() = $campo]"

-- Richard
Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Thomas Philips | last post by:
I recently had the need to sort a large number of lists of lists, and wondered if an improvement to the Decorate-Sort-Undecorate idiom is in the works. Ideally, I would like to sort the list of...
1
by: Kamilche | last post by:
I've written a generic sort routine that will sort dictionaries, lists, or tuples, either by a specified key or by value. Comments welcome! import types def sort(container, key = None,...
4
by: its me | last post by:
Let's say I have a class of people... Public Class People Public Sex as String Public Age as int Public Name as string end class And I declare an array of this class...
40
by: Elijah Bailey | last post by:
I want to sort a set of records using STL's sort() function, but dont see an easy way to do it. I have a char *data; which has size mn bytes where m is size of the record and n is the...
7
by: Stuart | last post by:
The stl::sort() that comes with Dev Studio 6 is broken (it hits the degenerate case in a common situation). I have a replacement. I would like to globally do "using namespace std; except use my...
7
by: DC Gringo | last post by:
I have a datagrid that won't sort. The event handler is firing and return label text, just not the sort. Here's my Sub Page_Load and Sub DataGrid1_SortCommand: -------------------- Private...
48
by: Alex Chudnovsky | last post by:
I have come across with what appears to be a significant performance bug in ..NET 2.0 ArrayList.Sort method when compared with Array.Sort on the same data. Same data on the same CPU gets sorted a...
10
by: Woody Ling | last post by:
In 32 bits DB2 environment, is it meaningful to set sheapthres larger than 256MB for the following case.. 1. Intra-parallel is ON 2. Intra-parallel is OFF
5
by: neehakale | last post by:
I know that heap sort,quick sort and merg sort are the faster sorting algoritms than the bubble sort,selection sort,shell sort and selection sort. I got an idea,in which situation we can use...
5
by: neocortex | last post by:
Hello! I am a newbie in Python. Recently, I get stuck with the problem of sorting by two criteria. In brief, I have a two-dimensional list (for a table or a matrix). Now, I need to sort by two...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.