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

Re: xml:base, resolve-uri and imported xslt files: how

Subject: Re: xml:base, resolve-uri and imported xslt files: how to get the importing base url from imported xslt
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Mon, 09 Oct 2006 19:59:38 +0200
Re:  xml:base
Michael Kay wrote:
You either
need to do the call on document() in the importing module; or you need to
make the base URI of the importing module accessible to the imported module
for example by declaring a global variable

<xsl:variable name="importing-base-uri" select="base-uri()"/>

in the importing module.

Thanks Michael.
This tip, combined with all the details provided by David and others, I thought of the following solution as a perfect best of breed, but couldn't get it to work:
- in the imported stylesheet, add a parameter 'importing-base-uri', required = yes.
- in the importing stylesheet, add the same parameter, but now with a value, overriding the required-attribute in the imported stylesheet.

The purpose was, using this construct, to raise an error when a user-defined stylesheet (it is part of a bigger concept) does not add the 'importing-base-uri' in his stylesheet, without requiring the processor to add the parameter as well. Alas, this does not work. I found out that (http://www.w3.org/TR/xslt20/#global-variables):

"If a stylesheet contains more than one binding for a global variable of a particular name, then the binding with the highest import precedence is used."

This seems to only apply to the binding, not to the other attributes of a parameter. But this import precedence does apply, when going from required=no to required=yes (???). Yes, really, like this:

IMPORTED: <xsl:param name="resource-location-url" select="'../'" />

IMPORTING: <xsl:param name="resource-location-url" required="yes" />

This works, making the resulting parameter, after import precedence, required. But I want it the other way around (making a required param non-required), which does not work, and leaves the resulting parameter as required (instead of being overridden by the importing param, like above).

Is this strange, or is it just me, or do I need new glasses? :D

I guess I have to resort to using the non-required variant.

-- Abel Braaksma

Current Thread


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.
First Name
Last Name
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.