Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


newbee question on apply-templates

From: "Raymond Du" <rdrd@-----.--->
To: NULL
Date: 6/1/2004 8:18:00 AM
Hi,

I posted a question earlier, did not quite get the answer I want.

I have xsl file like this:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
 <xsl:template match="Chapter">
 <h2>
  Chapter
  <xsl:value-of select="@number"/>:
  <xsl:value-of select="@title"/>
 </h2>
 <xsl:apply-templates />
  </xsl:template>
 <xsl:template match="Section">
 <h3>
  <xsl:value-of select="@title"/>
 </h3>
  </xsl:template>
</xsl:stylesheet>

and xml file like this:
<Chapter number="13" title="Viewing XML Data on the Web">
 <Section title="Going from XML to HTML"/>
 <Section title="Serving Up Your XML Data"/>
</Chapter>


The result html:
<h2>Chapter 13: Viewing XML Data on the Web</h2>
<h3>Going from XML to HTML</h3>
<h3>Serving Up Your XML Data</h3>

If I removed <xsl:apply-templates /> from xsl file, the html will be:
<h2>Chapter 13: Viewing XML Data on the Web</h2>

What is <xsl:apply-templates /> doing on this occasion?
The explanation I got was, it tried to match children of current element
with the template. Does that mean it try to apply <xsl:template
match="Chapter"> template to all the children of <Chapter number="13"
.....>, that should not affect the result html file because there are no
Chapter elements in the children.

Thanks in Advance




transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent