[Home] [By Thread] [By Date] [Recent Entries]
Jesper,
I think you made some thinking errors in your contribution I disagree strongly that "you never really need to use xsl:import. " In complex XSLTs I use both xsl:import and xsl:include simply to make sure I don't end up with ambiguous rules (I hate warnings coming from the execution of my stylesheets), still allowing me to make customizations, and I don't have to spend hours checking that the order is right. Would not know how to manage that without using both elements together I always thought that if there is an ambiguity between templates, the processor can just take one at random, not necessarily the last one. I might be wrong, would not make much of a difference, since I don't want the warnings anyway; Maybe I can encourage someone who knows for certain from the spec to step in Let's have a B.xsl with a template match = "*" copying <B/> to the output tree and have a C.xsl with a template match = "*" copying <C/> to the output tree all we have is
<xsl:template match="*">
<B/>
</xsl:template>
in B.xsl
and something similar in C.xslCase 1 ---------- <xsl:include href="B.xsl"/> <xsl:include href="C.xsl"/> You should get a warning: ambiguous rule... processor can pick any rule it wants, I thought, Saxon 9.3PE picks <C/>, does not contradict with what you are saying, but I still gets you a warning Case 2 ----------- <xsl:import href="B.xsl"/> <xsl:include href="C.xsl"/> will get us <C/>, you tell me it is because of the order, I say it is because of the fact that the <xsl:import> pushes down the priority of the B.xsl template Case 3 ---------- <xsl:import href="B.xsl"/> <xsl:import href="C.xsl"/> I did not mention this case, I try to avoid in my stylesheets that this rule comes into play end result is <C/> since B has lower precedence as it comes first In my opinion this is the only case of the 3 really triggered by the order Please be careful in your contributions. If somewhere in your contribution you have some sentence like "it is not true that", so in fact claiming that my statements were wrong, can I please suggest that you then read http://www.w3.org/TR/2007/REC-xslt20-20070123/#element-include and the next section on xsl:import before contributing (or read Michael Kay's book on page 357 and 372 , simply the first paragraph on the xsl element will do) you can also follow a link to MKs definition from this website http://www.xmlplease.com/xmltraining/xslt-by-example/xslt-by-example.html :-) cheers Geert At 10:17 3/09/2011, you wrote: Mark asked:
|

Cart



