Subject: Re: [xsl] xsl:apply-imports behavior wrong in Saxon? From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Thu, 04 Apr 2013 13:11:17 -0400 |
I have uncovered a significant difference in the way xsltproc and Saxon (both 6 and 9)
handle xsl:apply-imports when using a template mode. It seem that Saxon
is doing the wrong thing here, but I wanted to ask if others interpret it
this way. I cannot find anything in the archive on this subject.
I'm processing this simple document book.xml: ... with this stylesheet (modetest.xsl): ... And the imported no-mode.xsl stylesheet is: ... When I apply modetest.xsl to book.xml using xsltproc, the message output is just:
Reached apply-imports in modetest.xsl
When I apply modetest.xsl to book.xml using Saxon, the output is:
Reached apply-imports in modetest.xsl reached fallback in modetest.xsl for element title reached fallback in modetest.xsl for element para
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."
There is no template matching on book in mode="inside_mode" in the imported stylesheet, so the call on xsl:apply-imports should have no effect.
Why is Saxon applying templates in mode="inside_mode" to the children of book?
http://www.w3.org/TR/1999/REC-xslt-19991116#apply-imports ... xsl:apply-imports processes the current node using only template rules that were imported into the stylesheet element containing the current template rule; the node is processed in the current template rule's mode.
xsl:apply-imports reapplies the last-matched node in the last-matched mode using only the imported stylesheets (and it can't be used inside of a for-each).
http://www.w3.org/TR/1999/REC-xslt-19991116#built-in-rule There is a built-in template rule to allow recursive processing to continue in the absence of a successful pattern match by an explicit template rule in the stylesheet. ... There is also a built-in template rule for each mode, which allows recursive processing to continue in the same mode in the absence of a successful pattern match by an explicit template rule in the stylesheet.
-- Contact us for world-wide XML consulting and instructor-led training | Free 5-hour lecture: http://www.CraneSoftwrights.com/links/udemy.htm | Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ | G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx | Google+ profile: https://plus.google.com/116832879756988317389/about | Legal business disclaimers: http://www.CraneSoftwrights.com/legal |
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] xsl:apply-imports behavior wr, Bob Stayton | Thread | Re: [xsl] xsl:apply-imports behavio, Michael Kay |
[xsl] xsl:apply-imports behavior wr, Bob Stayton | Date | Re: [xsl] xsl:apply-imports behavio, Michael Kay |
Month |