[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: the document() in IE

Subject: Re: the document() in IE
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Wed, 11 Jul 2007 14:07:02 +0200
Re:  the document() in IE
David Carlisle wrote:
In FF and any other XSLT 1 processor I am aware of, the document()
function is relative to the base uri of the xslt file.

XSLT1 (and 2) specifies that the base uri used for resolving relative
URIs used in document is the base URI of the node that supplies the URI
(or the base URI of the node supplied as a second argument to document)
so, if you have a node in an XML file <href>a/b/c.xml</a> and go document(href)
then a/b/c.xml will be resolved relative to the base URI of the XML file
containing the href node.


On the other hand if you go document(string(href))
then the argument to document() is a string constructed in the
stylesheet and so  a/b/c.xml will be resolved relative to teh base URI
of the stylesheet.

document(string(href),/)

on the other hand uses a string from the stylesheet but resolves it
relative to the base URI of teh source node, /

Thanks for adding this depth, David.
Do you happen to know whether this holds for a variable or parameter? I.e., if the variable holds a LRE, or a string, I reckon this base uri should still be (by default) the current stylesheet. But if you have a variable holding a reference to an xpath into the source tree or an xml (using another document()), will it then be the base uri of this source tree which is used for resolution? Is this the same for xslt 1 and 2?


With your info, another (static or dynamic) resolution comes to mind:

document('path', document('absolute path to current xslt'))

where the second argument should be placed in a global parameter:

document('path', document($path-to-xslt))

which can then be set from the calling application. If you use a PI, you could make this dynamic with any SSI or CGI technique (only FF allows for parameters passed in the PI declaration, IE does not). The nice side of this solution is that it does not need a separate treatment for different browsers (whereas my solution creates a new relative path to the xslt, relative to the enclosing html, only when it is IE).

Finally: this new solution would work with document(), but not with xsl:import/include, which are relative to the xslt base always (and do not take parameters anyway).

Cheers,
-- Abel

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.