using apply templates refering to the same node
This is an open discussion with 2 replies, filed under XSLT.
Search
Add the mode attribute to apply-templates
. It's like naming a function.
For normal practice:
<xsl:apply-templates select="data/generalds/entry/years/item" mode="normal_practice" /> <xsl:template match="years/item" mode="normal_practice"> content </xsl:template>
Different content:
<xsl:apply-templates select="data/generalds/entry/years/item" mode="different_content" /> <xsl:template match="years/item" mode="different_content"> different content </xsl:template>
Perfect!
I had seen this before somewhere on this forum, but couldn't remeber where... thank you
Create an account or sign in to comment.
What's the best practice for referring to different templates using 'apply templates'
normal practice is
<xsl:apply-templates select="data/generalds/entry/years/item"/>
and the tempate:
<xsl:template match="years/item">content</xsl:template>
No i'd like to refer to the same node with different content:
<xsl:template match="years/item">different content</xsl:template>
What is the best approach? Or do i have to use 'template name' ?