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

Re: problem with xsl:import and namespaces

Subject: Re: problem with xsl:import and namespaces
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Tue, 17 Aug 2010 08:27:09 -0400
Re:  problem with xsl:import and namespaces
At 2010-08-17 14:19 +0200, Jostein Austvik Jacobsen wrote:
I've got five stylesheets, where test.xsl imports A.xsl and B.xsl,
A.xsl imports C1.xsl, and B.xsl imports C2.xsl. C1.xsl and C2.xsl is
in the same namespace, and defining the same function (i.e. C2.xsl is
a newer version of C1.xsl). Now, I wouldn't think that this would
cause a problem, as C1.xsl and C2.xsl is not imported directly into
the same stylesheet. test.xsl only makes use of C1.xsl and C2.xsl
indirectly via A.xsl and B.xsl, not knowing that there are multiple
versions of C (or that A.xsl and B.xsl uses C for that matter.)

However, when importing B.xsl after A.xsl in test.xsl, then the
function in C1.xsl is overridden by the one in C2.xsl, even when
called from A.xsl...

Yes, by definition. There is only *one* collection of top-level names when all of the importation and including is done.


I guess there's something I've missed about xsl:import and namespaces

All top-level names can be qualified with a namespace URI.


At the time of executing an instruction, there is a single set of names of top-level constructs. Which top-level construct can be seen is based on the instruction ... for example, <xsl:apply-templates/> will see one of every top-level construct name considering every tree in the import chain. When using <xsl:apply-imports/> the instruction will see one of every top-level construct name considering every tree in only imported stylesheets and their imports.

You are using function calls and function calls are resolved across the entire importation tree, not just a subset. So, the function call with the highest importance in the entire tree is going to be the one that is always called.

Latter imports in a stylesheet confer higher importance on imported stylesheet constructs than earlier imports. In the spec this concept of importance is referred to officially as the "import precedence".

I hope this helps.

. . . . . . . . . . Ken

--
XSLT/XQuery training:   after http://XMLPrague.cz 2011-03-28/04-01
Vote for your XML training:   http://www.CraneSoftwrights.com/s/i/
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Male Cancer Awareness Nov'07  http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal

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.