Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   XML (http://www.velocityreviews.com/forums/f32-xml.html)
-   -   XSLT and function document() (http://www.velocityreviews.com/forums/t598054-xslt-and-function-document.html)

Giovanni Leonetti 03-12-2008 10:46 AM

XSLT and function document()
 
Hi folks,

I have a question about the xslt function document().
What I want to do is :
1) access to an external xml document
2) read some data from the external xml document
3) access to the input xml document.


Let's say we have the documents :
- input.xml : input document
- style.xslt : XSLT file
- external.xml : external xml document

I will run the command line :

java org.apache.xalan.xslt.Process -IN input.xml -XSL style.xslt -OUT
out.xml

about 1) and 2) I know how to access to external.xml using the
function document('external.xml')
About 3) I need your help guys . I want to access to the input.xml
document but I do NOT want to call the function
document('input.xml'). Do you know if exists a parameter for the
function document() that let me know to access to the input document
avoiding an explicit call document('input.xml') ?
I hope is is enough clear my question.
Thanks,

Giovanni Leonetti

Richard Tobin 03-12-2008 11:16 AM

Re: XSLT and function document()
 
In article <990bccc8-3de9-4284-830d-13848060e769@f63g2000hsf.googlegroups.com>,
Giovanni Leonetti <gleonetti@gmail.com> wrote:

>What I want to do is :
> 1) access to an external xml document
> 2) read some data from the external xml document
> 3) access to the input xml document.


I assume your problem is that when you get to (3) the current node
is something from the "external" document, so you don't know how
to get back to the original input. Just set a variable to the
root node of the input document at the top level of the stylesheet,
and use that.

-- Richard
--
:wq

Giovanni Leonetti 03-12-2008 03:07 PM

Re: XSLT and function document()
 
Thasnks Richard

Now I can switch to the primary source document easily using the
variable :

<xsl:variable name="main-root" select="/"/> <!-- main input file
node-->

Giovanni Leonetti




All times are GMT. The time now is 02:34 PM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57