[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: matching question

Subject: Re: matching question
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 6 Aug 2008 12:32:09 +0100
Re:  matching question
  If my input is like

>   <a>
>      <b/>
>   </a>
> 
>   the above template matches only <a> 

No it also matches b.

The template will only be activated with b as the current node if
templates are applied to b.

initially the current node is the root of the document (/)
your template that matches child::node() does not match / as that is not
the child of anything so the default template is used, which does 
<xsl:apply-templates select="node()"/>

this selects the children of a which is the a element in your example.

your template matches a so will fire.

What happens next depends on what you puit in the ...


> <xsl:template match="node()">
> ...
> </xsl:template>

If you don't apply-templates then that is the end of processing. if you
do apply templates eg have again
<xsl:apply-templates select="node()"/>
or equivalently just
<xsl:apply-templates/>
then templates will be applied to teh children of a which consists of
two white space text nodes and a b element. Your template matching
node() would match all three of those nodes so would be fired a further
three times.


David

________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. 
________________________________________________________________________

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2011 All Rights Reserved.