This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: XSL doubts
- From: Peter Davis <pdavis152 at attbi dot com>
- To: saravanababuraman at kggroup dot com
- Cc: xsl-list at lists dot mulberrytech dot com
- Date: Mon, 22 Apr 2002 23:33:08 -0700
- Subject: [xsl] Re: XSL doubts
- References: <200204230604.LAA07772@tagindia>
- Reply-to: xsl-list at lists dot mulberrytech dot com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Monday 22 April 2002 23:04, saravanababuraman@kggroup.com wrote:
> Hai Friend
>
> well i have a doubt about the document open ,if i open the document as loop
> i could not able to acess the root variable from the XML inside the
> docuemnt loop do you find any solution for these please explain me the
> solution for these in the respected mail id saravanababuraman@kggroup.com
In the future you might consider posting to the XSL mailing list; most people
do not appreciate being contacted directly.
About your question, yes, this is a frequent problem. The solution is to
store a reference to the root of the first document in a variable before the
for-each, and then access the first document through that variable:
<xsl:variable name="root" select="/"/>
<xsl:for-each select="document('foo.xml')/bar">
...
<!-- access the /baz/zoit elements in the original document -->
<xsl:value-of select="$root/bar/zoit"/>
...
</xsl:for-each>
Let me know if this helps. Also, if you use the key() function, there are
other things you have to do.
- --
Peter Davis
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org
iD8DBQE8xQAsNSZCJx7tYycRAgFKAJ9xHofbwao7JXqynLR1Hofme5lypQCfVxYl
iSy08Gmwrq9CTC1tB5V5tX4=
=gwst
-----END PGP SIGNATURE-----
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list