dcsimg
October 23, 2018
Hot Topics:

XML

  • 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



Comment and Contribute

 


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

 

 


Enterprise Development Update

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

By submitting your information, you agree that developer.com may send you developer offers via email, phone and text message, as well as email offers about other products and services that developer believes may be of interest to you. developer will process your information in accordance with the Quinstreet Privacy Policy.

Sitemap

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