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

Re: [xsl] Getting the path to the stylesheet [RETRY]

Subject: Re: [xsl] Getting the path to the stylesheet [RETRY]
From: Michael Kay <mike@xxxxxxxxxxxx>
Date: Fri, 06 Jul 2012 12:12:18 +0100

On 06/07/2012 11:37, Chris Maloney wrote:
Why do we need the xsl:for-each on the document('').
This sets the context to be the root node of the stylesheet, so then the
unparsed-entity-uri() function acts based on that context.  From the spec:

The unparsed-entity-uri returns the URI of the unparsed entity with the
specified name in the same document as the context node
This is very clever! Thanks for sharing it, Ken!

Yes, indeed, it's a very neat idea.

One drawback is that I don't think you can rely on all XSLT processors getting it right:

(a) In the XSLT 1.0 spec it's not unambiguously clear that unparsed-entity-uri() is expected to return the absolute URI, and I believe there are processors that return the system ID as it appears in the source

(b) XML parsers aren't always very good at reporting information about unparsed entities. For example in Saxon-CE we generally can't get this information from the native XML parser in the browser, and so unparsed-entity-uri() generally doesn't work.

Michael Kay

Current Thread