This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: is document('') mandatory for xslt1-conformant processor?


> As I understand xslt1 spec is somewhat ambiguous about document('')
> feature. Firstly it says: "An XSLT processor is not required
> to support
> any particular URI schemas". But some paragraphs below it
> says: "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;...".
> So, is document('') mandatory or not?

"" is a relative URI, it does not use any URI scheme. (A URI scheme is
denoted by the part of the URI before the ":", e.g. the http scheme starts
"http:".) I think an XSLT 1.0 processor is obliged to support the document()
function with relative URIs.

One thing you do need to beware of: document("") actually selects the XML
entity whose URI is the same as the base URI of the stylesheet element
containing the call on document(""). If the stylesheet contains multiple XML
entities, this may not be whole stylesheet module. If the stylesheet is
embedded, this XML entity may contain more than the stylesheet module. If
the stylesheet uses xml:base to change the base URI, you may get something
completely different back. And the stylesheet module, of course, is not
necessarily the whole stylesheet.

> I care about it particularly because I involved in developing a
> specialized xslt processor, which compiles stylesheets to some
> intermediate code and so have trouble to get source of xsl stylesheet.

I think that document("") is allowed to fail if the user executing the
transformation does not have read permission to the source stylesheet. The
rule says that document("") is a reference to the source stylesheet, it
doesn't say that the user running the stylesheet has to have permissions to
access the source stylesheet, and like any other call on document(), it
should fail if the user doesn't have the necessary permissions.

Mike Kay


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]