Apply-templates

Discussion in 'XML Forums' started by Dennys2012, Apr 10, 2013.

  1. Dennys2012

    Dennys2012 New Member

    This is the code I have:\[code\]<xsl:template match="*"> <Segment ID="{name()}"> <xsl:value-of select="concat(., ' ')"/> </Segment> </xsl:template><xsl:template match="*" mode="break"> <Segment ID="{name()}"> <xsl:value-of select="."/> </Segment> <Segment>#$NL</Segment></xsl:template>\[/code\]Is there a way to call the first template inside the second template so that I don't have to repeat the code? Something like this:\[code\]<xsl:template match="*" mode="break"> <xsl:apply-templates select="*"/> <Segment>#$NL</Segment></xsl:template>\[/code\]I use * here and it doesn't work. I tried @* and / but nothing works. The goal is for me to call it like this: \[code\]<xsl:apply-templates select="FirstName"/> \[/code\]or \[code\]<xsl:apply-templates select="Name" mode="break"/>\[/code\]
     

Share This Page