xsl-list
[Top] [All Lists]

Re: [xsl] problem with xsl:import and namespaces

2010-08-17 07:44:43
Ah, ok. I guess I'll have to manually make sure that there aren't any
conflicts in the import tree then.

Thanks!
Jostein

2010/8/17 G. Ken Holman <gkholman(_at_)cranesoftwrights(_dot_)com>:
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(_at_)CraneSoftwrights(_dot_)com
Male Cancer Awareness Nov'07  http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>