Quackit Logo
FREE Hosting!
With every domain you register with ZappyHost you get FREE hosting.
Create free Flash websites

XSLT <apply-templates> Element

Print Version

We've already learned that the <xsl:template> element allows us to select any node in our XML document and transform its contents. You'll probably be happy to learn that we can also use this element to work with the children of that node.

The XSLT <xsl:apply-templates/> element allows us to determine where the content of its children appear on our transformed document.

Usage Example

Here, we are using two <xsl:template> elements; one for the root node, and one for its children.

We have placed the <xsl:apply-templates/> element within the <xsl:template> element for the root node. Doing this applies the results of our other <xsl:template> element.

<xsl:template match="/">
  (other content/HTML markup goes here)
  <xsl:apply-templates/>
</xsl:template>

<xsl:template match="child">
  (other content/XSLT/HTML markup goes here)
</xsl:template>

So, by doing this, we can use other XSLT elements to retrieve data from the child elements, and pass it to the main template for display. In particular, the XSLT <xsl:value-of/> element is useful for retrieving data from an XML element. We'll look at that element next.

Enjoy this website?

  1. Add this page to your Favorites
  2. Link to this page (copy/paste into your own website or blog):
  3. Help support Quackit by making a donation

Oh, and thank you for supporting Quackit!

Need Website Content?
Get unique, quality digital content for your website.
  • 270+ Website Templates
  • 800+ Flash Templates
  • 25,000+ Images, Logos
  • 30,000+ e-Books
  • 15,000+ Scripts
  • 27,000+ Animated GIFs
  • 21,000+ Ringtones
  • ...and much more!
Get your content now!
$1.99 .info domain names!
© Copyright 2000 - 2010 Quackit.com