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

Re: referring to variables using variables?

Subject: Re: referring to variables using variables?
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 13 Jan 2004 11:15:28 GMT
set variables using xslt
  Thanks very much for your help so far, just wanted to make absolutely sure i 
  understand the select statement in the for-each element  
  select="xx:node-set($index)/*", does it mean that every variable in index is 
  a node and if so why do you have to do that?

Michael's solution using xx:node-set() was the same as teh one I posted
using document().

It isn't that "every variable in index is  a node"  $index is a single
variable, with value a node set. "node set" is the main Xpath type and
is the only type that you can apply path expressions using / to
(The other Xpath types being number, boolean and string)

You can not, in XSLT 1 construct a new node set, only subset (using
selct expressions) node sets corresponding to input documents.

So to get a suitable node set, I suggested making a second input
document and including it with document() which gives a node set
consisting of a single document node, michael suggested putting similar
information in a variable (which produces a result tree fragment) and
then converting that to a node set with a single document node using a
node-set extension function.

Either way you end up with an in-mempry document that you can use as a
lookup table mapping from names to uris. You don't need to explictly
iterate over the table as the document() function is designed to accespt
a set of nodes as its argument, in that case it takes the string value
of each node, and interprets it as a uri, and returns the document
resulting from fetching that uri.

David

-- 
http://www.dcarlisle.demon.co.uk/matthew

________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

 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.