This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Converting attributes to elements and preserving the hierarchy
- From: Jeni Tennison <jeni at jenitennison dot com>
- To: xsl-list at lists dot mulberrytech dot com
- Date: Wed, 19 Dec 2001 10:58:22 +0000
- Subject: Re: [xsl] Converting attributes to elements and preserving the hierarchy
- Organization: Jeni Tennison Consulting Ltd
- References: <001001c18873$ba8353f0$465169d5@pcukmka>
- Reply-to: xsl-list at lists dot mulberrytech dot com
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