Ok, I think I understand now.
Through the use of mode="" it is possible to reverse the order.
Essentially, there are two templates that handle each node type, a mode=
version and a non-mode version. The mode= version can process its nodes
in the opposite order of the non-mode version.
The example as provided works, but needs one minor change if the <a>,
<c> and <d> templates are to be called for those elements which do not
contain <b> elements. The current template simply copies those nodes.
Change:
<xsl:template match="@*|node()" mode="identity">
<xsl:copy>
<xsl:apply-templates select="@*|node()" mode="identity"/>
</xsl:copy>
</xsl:template>
To:
<xsl:template match="@*|node()" mode="identity">
<xsl:apply-templates select="." />
</xsl:template>
This allows the non-"mode" templates for <a>, <c> and <d> elements to be
invoked on nodes which are not handled by match="*[b]".
It occurs to me that the order in which these templates are evaluated is
significant. For instance, match="*" and match="*[b]" could both apply
to an element containing a <b> element.
Is it valid to design a stylesheet which depends on the order in which
templates are declared?
Thanks very much for you help in solving this problem.
Chris.
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--