Skip to Content
XSLT
book

XSLT

by Doug Tidwell
August 2001
Intermediate to advanced
480 pages
11h 16m
English
O'Reilly Media, Inc.
Content preview from XSLT

How Do I Implement a for Loop?

The simple answer: you don’t. What XSLT calls variables are variables in the mathematical sense of the term. An <xsl:variable> can be assigned an initial value, but it can’t be changed. The upshot of this situation is that you can’t implement a for loop as you typically do in most procedural programming languages. However, earlier in the book we did implement a stylesheet that emulates a for loop. See Section 4.7 in Chapter 4 for a complete discussion of this example.

It’s much more likely that you need to iterate across a group of nodes in an XML document. If that’s the case, see Section 4.2.3 in Chapter 4 for more information.

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learning XSLT

Learning XSLT

Michael Fitzgerald
Inside XSLT

Inside XSLT

Steven Holzner
XSLT Cookbook

XSLT Cookbook

Sal Mangano

Publisher Resources

ISBN: 0596000537Supplemental ContentCatalog PageErrata