[xsl] Creating a tree variable and using it in later processing

Subject: [xsl] Creating a tree variable and using it in later processing
From: Alan Alda <alan4077alda@xxxxxxxxx>
Date: Thu, 19 Jul 2001 17:44:07 -0700 (PDT)

I have an input XML file in which the elements are not
sorted how I want. I need to 

1. sort the elements and
2. display these sorted elements in a particular

For example my XML file is:

	<product-group-list number="5">

As you can see, the input XML document comes to me
sorted by <number> and not by <name> (how the document
is sorted is not in my control :-( ). However, I need
to have my input sorted by <name> and I need to access
the sorted elements according to a certain predefined
order -for the sake of simplicity, lets say I need to
access alternate names in the sorted list.

Here the logic I am currently using:
(I am relatively new to XSL -my disclaimer- and heres
what I am trying to do)
1. Sort the <product> nodes by <name>
2. Store the sorted list in a variable called "tree"
3. Now access $tree, in order to pick out the <name>
nodes in whatever order I please.

The problem, as most of you must have guessed is that
I get an error "Reference to variable or parameter
tree must evaluate to a node list". The XSLT processor
I must use is Xalan - hence, the XSL version 1.0 W3C
recommendation. I have read about similar problems in
an XSL FAQ, but my case seems too simple not to have a

So my questions are:
How can I solve this problem without using any
extension functions like node-set() etc.? Is there any
logic other than the one I am considering that can
achieve the same effect?


Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail

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

Current Thread