[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: two at a time, using a sequence expression
John Cavalieri wrote:
<xsl:template match="/pairs"> <xsl:copy> <xsl:for-each select="for $i in 1 to (count(*) idiv 2 + (count(*) mod 2)) return *[($i*2)-1]"> <pair> <xsl:copy-of select="." /> <xsl:copy-of select="./following-sibling::*[1]" /> </pair> </xsl:for-each> </xsl:copy> </xsl:template> Doesn't the following suffice to achieve the same result? <xsl:template match="/pairs"> <xsl:copy> <xsl:for-each select="*[position() mod 2 = 1]"> <pair> <xsl:copy-of select="."/> <xsl:copy-of select="following-sibling::*[1]"/> </pair> </xsl:for-each> </xsl:copy> </xsl:template> -- Martin Honnen http://JavaScript.FAQTs.com/
|
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
|