XSLT and function document()

Discussion in 'XML' started by Giovanni Leonetti, Mar 12, 2008.

  1. 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
    Giovanni Leonetti, Mar 12, 2008
    #1
    1. Advertising

  2. In article <>,
    Giovanni Leonetti <> 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
    Richard Tobin, Mar 12, 2008
    #2
    1. Advertising

  3. 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
    Giovanni Leonetti, Mar 12, 2008
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Steve Carrow
    Replies:
    0
    Views:
    545
    Steve Carrow
    Jul 28, 2003
  2. Steve Carrow
    Replies:
    0
    Views:
    620
    Steve Carrow
    Jul 28, 2003
  3. Daniel Frey

    XSLT and document()/Node

    Daniel Frey, Nov 11, 2004, in forum: XML
    Replies:
    8
    Views:
    622
    Daniel Frey
    Nov 12, 2004
  4. Replies:
    2
    Views:
    592
    Martin Honnen
    May 6, 2005
  5. Replies:
    4
    Views:
    667
Loading...

Share This Page