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

RE: CURRENT NODE - Is it only determined through <xsl:templa

Subject: RE: CURRENT NODE - Is it only determined through <xsl:template match="X"> ???
From: Mike Brown <mbrown@xxxxxxxxxxxxx>
Date: Sun, 23 Jan 2000 13:21:53 -0700
node xsl
Jonathan Asbell wrote:
> Is the Current node only determined with the "match" attribute,
> or does "apply-templates" also determine current node.

xsl:apply-templates selects a set of nodes which becomes the "current node
list". The XSLT processor looks at each node in the list one by one in
document order, finds the template that best matches that node, and
instantiates the instructions found in that template, using the node as the
"current node".

xsl:for-each does the same thing, but the XSLT processor uses the contents
of the for-each element as the best matching template.

For apply-templates, you can have many templates that match a given node,
but there are rules that the XSLT processor follows to determine which of
the  matching templates is the "best" match. This conflict resolution is
described in section 5.5 of the XSLT 1.0 Recommendation. xsl:call-template
keeps the current node the same, and goes to the named template, honoring
similar conflict resolution rules.

> I am confused because once you match, you can also apply
> templates.  Where does the navigation refer from?

Understand question your I not do, but you might be incorrectly thinking
that the templates are being instantiated in a predictable order.

Processing always begins with the current node list being just the root node
of the main source tree. The best matching template for that one node is
found, and its instructions are instantiated with that node as the current
node. The best matching template is usually going to be the one that has
match="/", and there's a built-in one (assuming you're not using IE 5.0) for
this purpose.

"Navigating" from template to template, if you want to call it that, is a
matter of encountering an apply-templates in the instructions within a
template, selecting new nodes, finding a matching template for each node,
and executing the instructions therein.


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


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-2013 All Rights Reserved.