document() usage in xsl stylesheet

Discussion in 'XML' started by Patrick TJ McPhee, Sep 26, 2003.

  1. In article <3f733bec$0$2802$>,
    Stéphane Mottelet <> wrote:

    [...]
    % document(concat(@base,'.xml')) (*)
    %
    % will be interpreted (by W3C compliant xslt processors) as
    % document('/some/path/file.xml') because the result of concat
    % is a string and not a node-set. This is the case of Gnome's xsltproc,
    % the processor I am currently using. This is not the case of Xalan,
    % since this processor silently interprets (*) as document("file.xml").

    More precisely, the first argument is treated as a URI. I'm not sure
    how much leeway there is in interpreting URIs which don't include
    the protocol, but it seems like Xalan is treating this as a relative
    URI, while libxslt is treating it as if it were file:///some/path/file.xml.
    If there's no second argument and the first argument is a string,
    document() resolves relative URIs against the location of the stylesheet.

    You could try changing the concatenation to put file:// at the front
    if you know that the resulting URI is always going to be a file.
    --

    Patrick TJ McPhee
    East York Canada
    Patrick TJ McPhee, Sep 26, 2003
    #1
    1. Advertising

  2. Hi.

    How do you specify the document()'s arguments when
    the name of the document you want to load is obtained
    as a string, e.g.

    concat(@base,'.xml') ?

    The problem is that if the path of the xsl
    stylesheet is /some/path/, and @base contains
    "file" then

    document(concat(@base,'.xml')) (*)

    will be interpreted (by W3C compliant xslt processors) as
    document('/some/path/file.xml') because the result of concat
    is a string and not a node-set. This is the case of Gnome's xsltproc,
    the processor I am currently using. This is not the case of Xalan,
    since this processor silently interprets (*) as document("file.xml").

    My question is : how do I have to write the 2 arguments to document()
    to refer to a document's name obtained as a string (and not a node set). ?

    Thanks for help

    S.
    Stéphane Mottelet, Sep 26, 2003
    #2
    1. Advertising

  3. I got it : this is

    document(concat(@base,'.xml'), /)

    S.

    "Stéphane Mottelet" <> a écrit dans le
    message news: 3f733bec$0$2802$...
    > Hi.
    >
    > How do you specify the document()'s arguments when
    > the name of the document you want to load is obtained
    > as a string, e.g.
    >
    > concat(@base,'.xml') ?
    >
    > The problem is that if the path of the xsl
    > stylesheet is /some/path/, and @base contains
    > "file" then
    >
    > document(concat(@base,'.xml')) (*)
    >
    > will be interpreted (by W3C compliant xslt processors) as
    > document('/some/path/file.xml') because the result of concat
    > is a string and not a node-set. This is the case of Gnome's xsltproc,
    > the processor I am currently using. This is not the case of Xalan,
    > since this processor silently interprets (*) as document("file.xml").
    >
    > My question is : how do I have to write the 2 arguments to document()
    > to refer to a document's name obtained as a string (and not a node set). ?
    >
    > Thanks for help
    >
    > S.
    >
    >
    >
    Stéphane Mottelet, Sep 26, 2003
    #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. UndoMiel
    Replies:
    1
    Views:
    403
    Keith M. Corbett
    Sep 21, 2004
  2. Thomas Sommer
    Replies:
    0
    Views:
    422
    Thomas Sommer
    Nov 25, 2004
  3. MC
    Replies:
    1
    Views:
    7,232
    David Carlisle
    Mar 24, 2005
  4. David Blickstein
    Replies:
    3
    Views:
    1,024
    David Blickstein
    Aug 2, 2005
  5. Replies:
    0
    Views:
    519
Loading...

Share This Page