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

Re: Repeating something "n" times.

Subject: Re: Repeating something "n" times.
From: Mike Brown <mike@xxxxxxxx>
Date: Mon, 6 Nov 2000 18:23:11 -0700 (MST)
something repeating
robert@xxxxxxxxxxxx wrote:
> You're kidding me I have to do that? It'll work but is that the way it's
> done in XSL?

It's not a bug, it's a feature.
It's a side effect of having no side effects.
It's a FAQ, even.

> This won't work in my case because my template does stuff before it
> outputs the <BR>'s and I don't want it to do that stuff again and I really
> didn't want to have to factor that code into another template because then
> I have to pass a parameter that spans two templates.

If you are not trying to be puritan with your XSLT 1.0, you can use a
result-tree-fragment-to-node-set extension function provided by your XSLT
processor, like this:

<xsl:variable name="sixNodes">
   <x/><x/><x/><x/><x/><x/>
</xsl:variable>
<xsl:for-each select="saxon:node-set($sixNodes)/*">
  ...stuff to do six times...
</xsl:for-each>

It is interesting that when this becomes implicit in XSLT 1.1, tail
recursion won't be necessary for this kind of iteration anymore. It will
also be possible to create the equivalent of arrays and hashes.

   - Mike
____________________________________________________________________
Mike J. Brown, software engineer at         My XML/XSL resources:
webb.net in Denver, Colorado, USA           http://www.skew.org/xml/


 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.