Re: [xsl] Converting attributes to elements and preserving the hierarchy

Subject: Re: [xsl] Converting attributes to elements and preserving the hierarchy
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Wed, 19 Dec 2001 10:58:22 +0000
Mike Kay wrote:
> For advanced users: use xsl:for-each only when you are absolutely
> confident that the structure of the source documents handled by your
> stylesheet is not going to change.

I use another guideline, which is to use xsl:for-each when you use the
position() or last() function in the 'template' (the content of the
xsl:for-each or xsl:template).

The reason for this is that the result of the position()/last()
functions for a particular node are completely dependant on the nodes
that are selected for processing. I think keeping the location path
that selects the nodes and the use of the position()/last() functions
close together (as you do with an xsl:for-each) makes the stylesheet
easier to understand and maintain than when the location path and the
function call are in completely different parts of the stylesheet.

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


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


Current Thread