XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
Justin KohlheppSubject: Using document() inside - access source doc?
Author: Justin Kohlhepp
Date: 13 Mar 2007 09:21 AM
I have code like this:

<for-each select="document('data.xml')/such/and/such">
<!-- snip -->
</for-each>

Inside the for-each, I want to access some nodes from the source doc using XPath, but it seems like all of my XPath statements match only the data.xml doc referenced in the document() function. For instance, an <apply-templates select="/"/> in the for-each will match the root node of the data.xml doc.

Is there a way I can use XPath (or another mechanism maybe) to get back to the original source doc passed to the processor?

Thanks in advance,

~ Justin


P.S. I am fairly novice with XSLT so this may be a stupid question.

Posttop
Ivan PedruzziSubject: Using document() inside - access source doc?
Author: Ivan Pedruzzi
Date: 13 Mar 2007 12:10 PM

Save the context into a variable like this

<xsl:variable name="mainInput" select"/"/>
<for-each select="document('data.xml')/such/and/such">
<xsl:apply-templates select="$mainInput"/>
</for-each>

Ivan Pedruzzi
Stylus Studio Team
http://www.stylusstudio.com/xml_download.html

 
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.