ncyoung.com

numerical iteration in XSL

This entry is in the following categories:

I keep running into this problem in XSL: how do you do something a certain number of times?

The first answer is that you recurse. Ok, there's a place for recursion, but not everywhere.

So the next way is to find a set of nodes to iterate over. The classic version is:

<xsl:for-each select="//*[position() <= Value]">

And some hilarious variations are here.

When we get XSL 2.0 it looks like we'll have some much better options.



Dated: 12/04/2003