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

RE: [XSLT Streaming] Are xsl:for-each and xsl:iterate

Subject: RE: [XSLT Streaming] Are xsl:for-each and xsl:iterate equivalent?
From: "Costello, Roger L." <costello@xxxxxxxxx>
Date: Thu, 29 Aug 2013 13:37:47 +0000
RE:  [XSLT Streaming] Are xsl:for-each and xsl:iterate
Thanks David, this is excellent.

Let me see if I've got it:

xsl:for-each should be thought of as all items in the selected sequence being
processed in parallel. Consequently, "breaking out" of the loop makes no
sense.

xsl:iterate should not be thought of that way.  xsl:iterate should be thought
of as iterating sequentially, from the first item to the last item.
Consequently, "breaking out" of the loop makes good sense.

To my way of thinking, streaming means that we start at the top and
sequentially make our way through the document (or break out if desired).
Given that, it seems like when doing streaming Best Practice is to use
xsl:iterate and not use xsl:for-each. Do you agree?

/Roger

-----Original Message-----
From: David Carlisle [mailto:davidc@xxxxxxxxx]
Sent: Thursday, August 29, 2013 9:23 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Cc: Costello, Roger L.
Subject: Re:  [XSLT Streaming] Are xsl:for-each and xsl:iterate
equivalent?

On 29/08/2013 14:10, Costello, Roger L. wrote:
> I realize that xsl:iterate has some capabilities that xsl:for-each
> doesn't have, such as the ability to break out of the loop before
> processing the entire sequence.
>
> But leaving that aside, they are both ways of looping over a
> sequence of items, right?

It's best not to think of for-each in those terms (even though it can be
streamed if the select attribute xpath is streamable) as in general it
gives no guarantee on execution order at all (which is why it wouldn't
make sense to "break out" of the loop). It is best to think of it as
being a parallel region in which all the selected items are processed
(even if a given, or all, implementations actually process the items one
at a time)

David


--
google plus: https:/profiles.google.com/d.p.carlisle

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.