[Home] [By Thread] [By Date] [Recent Entries]
On 11/16/06, David Carlisle <davidc@xxxxxxxxx> wrote:
Also, if a matching template does not implicitly depend on its current node implicit parameter, then probably it has better chances for optimization (the same reasoning as for why an xsl:function has its current node unsefined). So, changing the current node before instantiating the matching template could be something similar to this code (this should be regarded only as pseudo-code, of course): <xsl:for-each select="$current-node-list"> <xsl:call-template name="name-of-bestMatching template">
<!-- With whatever other parameters -->
</xsl:call-template >
</xsl:for-each>
<xsl:template name="apply-templates">
<xsl:param name="current-node-list"/> <xsl:if test="$current-node-list">
<xsl:call-template name="instantiateTemplate">
<xsl:with-param name="currentNode" select="$current-node-list[1]"/>
<xsl:with-param name="name-of-bestMatching template"/> <!-- With whatever other parameters -->
</xsl:call-template> <xsl:call-template name="apply-templates">
<xsl:with-param name="current-node-list"select="$current-node-list[position() > 1]"/>
</xsl:call-template>
</xsl:if>
</xsl:template>This is all in XSLT 1.0, in XSLT 2.0 the processing will be more complex but could probably be better expressed using xsl:function.
-- Cheers, Dimitre Novatchev --------------------------------------- Truly great madness cannot be achieved without significant intelligence. --------------------------------------- To invent, you need a good imagination and a pile of junk ------------------------------------- You've achieved success in your field when you don't know whether what you're doing is work or play
|

Cart



