Re: XSLT 1.0: xsl:apply-imports when there is no overridden rule

Kay Michael wrote:
 
> Section 5.6 says that "A template rule that is being used to override a
> template rule in an imported stylesheet can use <xsl:apply-imports>"; it
> does not say what happens if there is no such overridden rule. I can think
> of at least three defensible interpretations: signal an error, invoke the
> built-in template rule, or do a no-op.
> 
> A user has reported that Saxon and MSXML3 behave differently in this area.

Section 5.8 says: "The built-in template rules are treated as if they
were imported implicitly before the stylesheet".  So the correct
behaviour is to invoke the built-in template rule.

> The user was actually using xsl:apply-imports from within a template called
> by name, and it might be that it was this that caused the difference. I
> think the spec here can only be read one way, though it could be more
> explicit: the phrase quoted above leaves room for doubt about whether
> <xsl:apply-imports> can correctly be used outside a template rule,

It can be used if and only if the current template rule is non-null.

> neither
> does it explicitly say that <xsl:call-template> leaves the current template
> rule unchanged.

It says that "Whenever a template rule is chosen by matching a pattern,
the template rule becomes the current template rule for the
instantiation of the rule's template. When an xsl:for-each element is
instantiated, the current template rule becomes null for the
instantiation of the content of the xsl:for-each element." I don't see
any room for doubt there about whether xsl:call-template changes the
current template rule.

James

Received on Wednesday, 6 December 2000 05:33:09 UTC