[xsl] applying templates to all descendants

Subject: [xsl] applying templates to all descendants
From: Adam Van Den Hoven <Adam.Hoven@xxxxxxxxxxxx>
Date: Wed, 10 Jan 2001 10:57:44 -0800
Lets say that I have the following XML (borrowed from MS)
<COLLECTION>
  <BOOK>
    <TITLE>Cosmos</TITLE>
    <AUTHOR>Carl Sagan</AUTHOR>
    <PUBLISHER>Ballantine Books</PUBLISHER>
  </BOOK>
  <BOOK>
    <TITLE>Catwings</TITLE>
    <AUTHOR>Ursula K. Le Guin</AUTHOR>
    <PUBLISHER>Scholastic</PUBLISHER>
  </BOOK>
  <BOOK>
    <TITLE>Home Town</TITLE>
    <AUTHOR>Tracy Kidder</AUTHOR>
    <PUBLISHER>Random House</PUBLISHER>
  </BOOK>
</COLLECTION>
and an XSL file that contains:
<xsl:template match="/" >
	...STUFF...
	<xsl:apply-templates select="/COLLECTION//*" />
	...STUFF...
</xsl:template>
<xsl:template select="BOOK">
	...STUFF...
	<xsl:apply-templates select="*" />
	...STUFF...
</xsl:template>
<xsl:template select="TITLE">
	...STUFF...
</xsl:template>

will the TITLE template get executed in the context of the root template AND
the BOOK template or just the BOOK template. That is, having matched a node
to a template, will apply-templates continue to make matches to its
descendants. 
I suppose I could avoid complication by making use of modes (and I will do
that regardless), I'm really interested in knowing what the behaviour is. 

> 		Adam van den Hoven
> 		Internet Application Developer
> 		Blue Zone
> 		tel. 604.685.4310
> 		fax. 604.685.4391
> 
> Blue Zone makes you interactive. http://www.bluezone.net/
> 
> 
> 
> 

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread