Subject: RE: [xsl] How to get out the document()-file From: "Passin, Tom" <tpassin@xxxxxxxxxxxx> Date: Tue, 27 Jul 2004 12:13:05 -0400 |
> From: Roger [mailto:oxyme@xxxxxxxxxx] > > I have the following problem. I have an external xml-data-document > (list.xml) from which I read a list of elements using the document() > function. I want use a for-each-selection for all those elements, to > display them all in a row. Inside the for-each, I need to use data from > the original xml-data-document (data.xml). > > Now I don't get any data displayed from the data.xml document inside the > for-each. I've used an absolute path to get to the root of the data.xml > file, but that doesn't seem to work. I've checked the absolute path > outside of the for-each, and there it works fine. So I suppose I'm > trapped into the list.xml document. How do I get out? Any ideas? This is a common situation. While you are within the for-each block, the context comes from the external document, so path expressions refer to it, not to the original source document. The solution is to create a global variable for the source document, like this - <xsl:variable name='source-doc' select='/'/> You can use this variable, which contains all the nodes from the source document, within the for-each loop. Note that you may want to be more specific than "/", depending on your needs. Cheers, Tom P
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] How to get out the docume, David Carlisle | Thread | [xsl] Merging and sorting multiple , Herve Dubreuil |
Re: [xsl] How to get out the docume, David Carlisle | Date | [xsl] Merging and sorting multiple , Herve Dubreuil |
Month |