[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Act as xsl:next-match in XSLT 1 with xsl:apply-imports (not possible?)


Subject: Re: [xsl] Act as xsl:next-match in XSLT 1 with xsl:apply-imports (not possible?)
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 23 Mar 2007 16:49:46 GMT

> The reason is obvious: the XSLT 1.0 spec mandates that when two imports 
> are of equal import precedence (i.e., in the same file) then template 
> matches that appear lowest in the importing file take precedence and the 
> rest is discarded. Because of "being discarded", I believe the 
> <xsl:apply-imports /> does not work recursively.

I don't think that the spec describes these templates as being discarded,
and in fact two imports are never in equal precedence.
However (unfortunately) apply-imports is not defined to mean "next match
in import precedence order" it is only defined to consider stylesheets
that are imported into _this_ stylesheet module, so in a situation where
one stylesheet imports all the rest, any apply-imports in the imported
files will be a no-op as they don't themeselves have any imports.

As you said You need a thin deep tree, not a short fat one if you want
to use xsl:apply-imports.


The semantics of xslt 2's next match are a lot easier to understand,
more or less: "choose the template you would have chosen if this one had
not been here".

David


Current Thread
Keywords