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

RE: ordering and iteration problem

Subject: RE: ordering and iteration problem
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Wed, 2 May 2001 08:03:34 -0700 (PDT)
iteration shakespeare
> > I was just wondering why this "design
> > pattern" was typically described using "document('')//node()" when
> > "//node()" seemed to be more correct.
> Because in a typical scenario, the stylesheet author knows how many nodes
> there are in the stylesheet, but has no idea how many there will be in the
> source document.
> Mike Kay
> Software AG

It is also worth noting that a huge number of additional nodes can be easily added to the
stylesheet. An example can be found at 

In case the stylesheet is like this:
<xsl:stylesheet version='1.0'

    <!-- Hamlet goes here -->

  <!-- the rest of the stylesheet -->

where the included text is the xml version of "Hamlet" from Jon Bosak's site

In this case if the st variable holds the stylesheet:

<xsl:variable name="st" select="document('')"/>

then the following expression:
  count($st//node() | $st//@* | $st//namespace::*)
evaluates to 32032

While such a technique is definitely ugly it is still the only means to prevent imperfect XSLT
processors from crashing under deep recursive processing.

Dimitre Novatchev.

Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices

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

Current Thread


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.
First Name
Last Name
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.