Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 19th, 2006, 09:28 AM
Registered User
Join Date: Apr 2006
Location: Rochester, MI, USA.
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default node-set function

Is something like this possible?

I have an outside function that returns xml, and I want to store that xml in an xslt variable and further process it. For example:

<xsl:variable name="getXml">


<xsl:value-of select="exsl:node-set($getXml)/element"/>
Is this possible? If not, what other options do I have? Thanks a lot!

Reply With Quote
  #2 (permalink)  
Old June 19th, 2006, 09:54 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts

That's very possible, most processors have a node-set function. Alternatively the document function will return a document root so you won't need an extension:
 <xsl:variable name="externalDoc" select="document('http://www.myDomain.com/myXmlSite/myXmlPage.aspx')"/>
In version 2.0 of XSLT you don't need an extension function, even if your variable is like:
<xsl:variable name="externalDoc"></xsl:variable>
as this is converted automatically to a root node.


Joe (Microsoft MVP - XML)
Reply With Quote
  #3 (permalink)  
Old June 19th, 2006, 10:45 AM
mhkay's Avatar
Wrox Author
Points: 18,487, Level: 59
Points: 18,487, Level: 59 Points: 18,487, Level: 59 Points: 18,487, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts

Many XSLT processors support this kind of functionality, but the details depend on the processor.

If the external function returns a node-set, there will be no need to convert it to a node-set using exsl:node-set.

The more portable approach is to use the document() function (many processors allow you to write a URIResolver or XmlResolver that intercepts the request and returns say a DOM Document node as the result), or to pass the document in as a stylesheet parameter.

Michael Kay
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
XPath: set operation with a disjoint node set rich_unger XSLT 7 May 6th, 2008 09:24 AM
Expression must evaluate to a node-set. XMLUser XSLT 3 February 5th, 2008 01:27 PM
Converting String into Node-set dved XSLT 3 January 23rd, 2008 12:40 PM
function node-set bound to undefined prefix exslt khwab XSLT 3 August 8th, 2007 12:31 PM
Filtering out from a node set anothervbaddict XSLT 1 May 22nd, 2007 08:42 AM

All times are GMT -4. The time now is 07:17 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.