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

Re: [xsl] xsl:apply-imports behavior wrong in Saxon?

Subject: Re: [xsl] xsl:apply-imports behavior wrong in Saxon?
From: Michael Kay <mike@xxxxxxxxxxxx>
Date: Thu, 4 Apr 2013 18:38:56 +0100

The situation is that you are calling xsl:apply-imports when there is no
matching user-defined template rule in an imported stylesheet.

The XSLT 2.0 specification is clear about what happens here:

"If no matching template rule is found that satisfies these criteria, the
built-in template rule for the node kind is used."

The XSLT 1.0 specification is less clear on the subject. It says

(a) "xsl:apply-imports processes the current node using only template rules
that were imported into the stylesheet element containing the current template
rule", and

(b) "The built-in template rules are treated as if they were imported
implicitly before the stylesheet"

My belief is that if you read these two statements together, they indicate
that the same behaviour as in 2.0 is intended. There's room for debate,
however, because of the phrase "before the stylesheet" as distinct from "into
the stylesheet".

Michael Kay

On 4 Apr 2013, at 17:10, Bob Stayton wrote:

> According to Saxon author Michael Kay's website, his description of
> xsl:apply-imports is:
> "The effect is to search for a template that matches the current node and
> that is defined in a stylesheet that was imported (directly or indirectly,
> possibly via xsl:include) from the stylesheet containing the current
> template, and whose mode matches the current mode. If there is such a
> template, it is activated using the current node. If not, the call on
> xsl:apply-imports has no effect."
Yes. That was written a long time ago, and it's wrong. I will fix it.

Current Thread