1 reply
by bmilbank
Generally, I prefer xsl:for-each. It is more program-ish and has the added benefit of avoiding problems with unwanted recursion when using xsl:include.
xsl:for-each is particularly useful when using named templates and then using xsl:call-template to invoke a template ... much like invoking a method or subroutine in a program.
Barring that, however, xsl:template does allow recursion without an explicit loop. I guess I am a control freak ... I want my recursion to be explicit and not implicit.
The end result: it is a matter of preference. Since I tend to modularize my XSL transformation documents (e.g., generic HTML XSLT, IE-specific XSLT, Netscape-specific XSLT, and then manage the inclusions dynamically, for-each and named templates tends to work much better and with less confusion ... particularly when debugging.
bmm
This discussion is closed to new replies.
Trending Web Development posts
Sort by Trending