This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

applying templates to all descendants


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]