[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] XALAN does not handle document('') as expected to carry out an in-stylesheet look-up


Subject: Re: [xsl] XALAN does not handle document('') as expected to carry out an in-stylesheet look-up
From: "Thomas B. Passin" <tpassin@xxxxxxxxxxxx>
Date: Thu, 1 Nov 2001 16:35:38 -0500

[<David_N_Bertoni@xxxxxxxxx>]
>
>
> Working as designed.  I suspect that most processors work this way, since
> stylesheets are processed with the goal of building an efficient run-time
> mechanism for performing the transformation described by the stylesheet.
> Also, there are different rules for interpreting stylesheet xml files and
> source documents.  From the recommendation:
>
>    "When the first argument to the document function is not a node-set,
the
>    first argument is converted to a string as if by a call to the string
>    function. This string is treated as a URI reference; the resource
>    identified by the URI is retrieved. The data resulting from the
>    retrieval action is parsed as an XML document and a tree is constructed
>    in accordance with the data model (see [3 Data Model])."
>
> and
>
>    "Note that a zero-length URI reference is a reference to the document
>    relative to which the URI reference is being resolved; thus
document("")
>    refers to the root node of the stylesheet; the tree representation of
>    the stylesheet is exactly the same as if the XML document containing
the
>    stylesheet was the initial source document."
>
> Of course, a processor _could_ detect references to the stylesheet by
> looking for any calls to the document() function, but it would be
> impossible to detect all cases, so I don't see how this would work.
>
> You might think about using an EntityResolver to solve this problem.  I'd
> recommend you post a question on the Xalan mailing list for more
> information.
>

Seems to me that this is very clear - document('') should give you the root
of the stylesheet, which is what Mark wanted.  Instead, it seems that Xalan
is trying to get a document at the base url of the xml document.  This would
give the same result if it had in fact been in the same directory as the
stylesheet, but here there never was a physical xml document.

Sounds like a bug to me.

Cheers,

Tom P


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



Current Thread
Keywords
xml