> Well yes, but I would have thought that xsl like you didn't show the only part of your XSL that matters. Namely the command that constructs the current node list. position() counts the position of the current node in the current node list. It isn't directly tied to the input document or the currently active template. given <objects> <!-- hello --> <object name="first"/> <object name="second"/> <!-- hello --> <object name="third"/> <object name="fourth"/> </objects> if you go <xsl:apply-templates/> then you default to select="node()" and so the current list is 1 white space 2 comment 3 white space 4 object 5 white space 6 object ... unless you specified in your stylesheet that white space should be stripped (or you use MSXML3 which takes a "liberal" reading of the spec on this point) If you only want object nodes in your list just select those and have <xsl:apply-template select="object"> then you get a list 1 object 2 object ... > Also on a related point how can I output the preceding node if and > only if it is a comment. <xsl:copy-of select="preceding::*[self::comment()]"/> David _____________________________________________________________________ This message has been checked for all known viruses by Star Internet delivered through the MessageLabs Virus Control Centre. For further information visit http://www.star.net.uk/stats.asp XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format