This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Converting attributes to elements and preserving the hierarchy


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]