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

RE: Remote source document

Subject: RE: Remote source document
From: Rene de Vries <RdVries@xxxxxxxxxxx>
Date: Wed, 25 Jul 2001 09:56:08 +0200
remote document
Hi Jesper,

As others suggested you can save the root of your original document.
I suppose this was not your complete template (it doesn't do much), but if 
you don't need any information from Config.xml to do the select for the 
.../Name in your for-each, you can also put the Name in a variable before 
you enter the for-each and use that in your for-each:
	<xsl:template name="ProductPrice">
		<xsl:variable name="productID">
			<xsl:value-of select="@ID"/>
		</xsl:variable>
		<xsl:variable name="productName">
			<xsl:value-of select="/ProductInformation/Products//Product[@ID = 
$productID]/Name"/>
		</xsl:variable>
		<xsl:message>
			<xsl:value-of select="$productName"/>
				<!-- This message works fine. -->
		</xsl:message>
		<xsl:for-each select="document('Config.xml')/Config/Prices/PriceSet">
			<xsl:message>
			<xsl:value-of select="$productName"/>
				<!-- This message works now fine too. -->
			</xsl:message>
		</xsl:for-each>
	</xsl:template>

Greetings Rene
   { @   @ }
        ^
      \__/

"You don't need eyes to see, you need vision!"

-----Oorspronkelijk bericht-----
Van:	Jesper Stovby Damgaard [SMTP:Jesper.Damgaard@xxxxxxxxx]
Verzonden:	woensdag 25 juli 2001 9:29
Aan:	'xsl-list@xxxxxxxxxxxxxxxxxxxxxx'
Onderwerp:	 Remote source document

Hello,

I have a problem with a remote ducument. I use 'for-each' to itterate 
through som elements in a remote document using 'document()'. However 
beeing in the loop i seem to loose scope of the original document. How do i 
acces elements in the original source document within the loop?


	<xsl:template name="ProductPrice">
		<xsl:variable name="productID">
			<xsl:value-of select="@ID"/>
		</xsl:variable>
		<xsl:message>
			<xsl:value-of select="/ProductInformation/Products//Product[@ID = 
$productID]/Name"/>
				<!-- This message works fine. -->
		</xsl:message>
		<xsl:for-each select="document('Config.xml')/Config/Prices/PriceSet">
			<xsl:message>
				<xsl:value-of select="/ProductInformation/Products//Product[@ID = 
$productID]/Name"/>
					<!-- This message does not work. The rootnode is the rootnode of the 
remote document -->
			</xsl:message>
		</xsl:for-each>
	</xsl:template>


Best regards,
Jesper S. Damgaard

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


 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.