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

Re: position()

Subject: Re: position()
From: Mike Brown <mike@xxxxxxxx>
Date: Sun, 16 Apr 2000 10:29:01 -0600 (MDT)
willy brown execution
Dan Morrison wrote:
> For-each works on an ordered set, but templates get applied willy-nilly.

There's no rule that templates get applied willy-nilly. In fact, David
Carlisle and I were just discussing how the XSLT spec says in so many
words that for both xsl:for-each and xsl:apply-templates, "the nodes are 
processed in document order" in the absence of an xsl:sort specifying
some other order.

In order (ha) for any template other than the one that matches the root
node to be applied, there must be an instruction somewhere, either in an
explicit or a built-in template, that says <xsl:apply-templates
select="foo">, where foo is an XPath expression identifying a node-set to
be processed.

If Dave Pawson traces the order of execution of templates, starting at the
root node, and taking into account the built-in templates, he will
probably find that he accidentally told the XSL processor to process the
'section' elements as part of a list of nodes in which those element nodes
occupy the 2nd, 6th, 10th, etc positions in the list.

> Your results in the second case give a glimpse into what the parser was
> doing in between the last two 'sections'.

Right.

> It's all about context. You're asking for a postion in an unsorted,
> non-homogenous list.

The list will have some kind of order, either document order or the order
imposed with an xsl:sort, but we don't know what the list is without
seeing the rest of his stylesheet.

> This is such an odd quirk It ought to be put in a FAQ somewhere. 

Dave Pawson is the maintainer of the FAQ :)

> seems legal to me, but a very odd side-effect.

Don't use side-effect to describe undesirable/confusing results :)

-Mike


 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.