October 21, 2016
Hot Topics:


  • November 19, 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

Comment and Contribute


(Maximum characters: 1200). You have characters left.



Enterprise Development Update

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

Sitemap | Contact Us

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