July 18, 2019
Hot Topics:


  • November 20, 2002
  • By Sam Huggill
  • Send Email »
  • More Articles »

In XSL, you can encapsulate code in a "template". This acts rather like a function, and can be very useful. Here is a typical template:

<xsl:template name="demo"match="people/person">    <xsl:value-of select="@name"/>    <xsl:value-of select="@email"/></xsl:template>

You can call a template using the <xsl:call-template> tag.

We can now rework our loop to use a template:

<xsl:template name="person"match="people/person">    <xsl:value-of select="@name"/>    <xsl:value-of select="@email"/></xsl:template><xsl:template match="/"><xsl:for-eachselect="people/person">    <xsl:call-template name="person"/></xsl:for-each>

Page 4 of 6

Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

Thanks for your registration, follow us on our social networks to keep up-to-date