Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old June 19th, 2006, 09:28 AM
Registered User
Join Date: Apr 2006
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!

Old June 19th, 2006, 09:54 AM
joefawcett's Avatar
Wrox Author
Join Date: Jun 2003
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)
Old June 19th, 2006, 10:45 AM
mhkay's Avatar
Wrox Author
Join Date: Apr 2004
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

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

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