Are you sure about that? If I create a stylesheet with no templates defined in it, and process something like: <foo>This is some text.</foo>
I get the text printed out. If I then import another stylesheet which also has no templates, shouldn't I still get the same result? Are you saying that I should get nothing in this case? Chris Morten Jorgensen wrote: >Chris, > >This makes sense. But <xsl:apply-imports/> should not invoke default >templates unless the current stylesheet does not import anything. > >Morten Jorgensen, >XML Technology Centre, >Sun Microsystems Ireland ltd. > >Chris McCabe wrote: > >>It should do whatever a "foo" element would do in E.xsl by itself, which >>may or may not be nothing. It could be the default template rule. That >>is how I would interpret the spec anyway. I am pretty sure it should >>not invoke the template from B.xsl. >> >>Chris >> >>Morten Jorgensen wrote: >> >>>I have spent some time on cleaning up XSLTC's implementation of >>>the xsl:apply-imports element and I have come across a scenario >>>that seems to be handled differently by the various XSLT processors. >>>I'd like some help with determing what the correct behaviour for >>>XSLTC is. Consider that you have these stylesheets: >>> >>> A.xsl imports B.xsl, which imports C.xsl >>> A.xsl imports D.xsl, which imports E.xsl >>> >>>Stylesheets A, B, C and D all have a template that matches on >>>an element "foo" - stylesheet E does _not_. This matching >>>template looks like this (in all of the first 4 stylesheets): >>> >>> <xsl:template match="foo"> >>> <A><xsl:apply-imports/></A> >>> </xsl:template> >>> >>>The xsl:apply-imports elements is similar to a call to "super()" >>>in Java, so the template in A.xsl triggers the template in D.xsl >>>(because this is the imported template with the highest import >>>precedence). There are no matching templates in E.xsl, so what >>>should the template in D.xsl do? >>> >>> A) Nothing? >>> B) Trigger the matching template in B.xsl? >>> >>>Saxon goes with option A), while Xalan (and currently XSLTC) goes >>>with option B). I am tempted to say that Saxon is correct, as >>>template D.xsl does not "inherit" any behaviour from template B.xsl. >>> >>>Any input welcome! >>> >>>Morten Jørgensen, >>>XML Technology Centre, >>>Sun Microsystems Ireland ltd. >>>