Subject: Re: [xsl] problem with xsl:import and namespaces From: Jostein Austvik Jacobsen <josteinaj@xxxxxxxxx> Date: Tue, 17 Aug 2010 14:44:32 +0200 |
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@xxxxxxxxxxxxxxxxxxxx>: > 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. B 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. B 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. B 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. B 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. B In the spec this concept of > importance is referred to officially as the "import precedence". > > I hope this helps. > > . . . . . . . . . . B Ken > > -- > XSLT/XQuery training: B after http://XMLPrague.cz 2011-03-28/04-01 > Vote for your XML training: B http://www.CraneSoftwrights.com/s/i/ > Crane Softwrights Ltd. B B B B B http://www.CraneSoftwrights.com/s/ > G. Ken Holman B B B B B B B B mailto:gkholman@xxxxxxxxxxxxxxxxxxxx > Male Cancer Awareness Nov'07 B http://www.CraneSoftwrights.com/s/bc > Legal business disclaimers: B http://www.CraneSoftwrights.com/legal
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] problem with xsl:import a, G. Ken Holman | Thread | [xsl] flexibly sized region after, Trevor Nicholls |
Re: [xsl] problem with xsl:import a, G. Ken Holman | Date | Re: [xsl] Q: XSLT 1.0 output of nam, Michael Kay |
Month |