[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Re: Re: Re: Unbounded element grouping/concatenati
Dimitre, One change to your algorithm... the xsl:choose inside the record match is not required because the continuation records are copied when each header record is selected. Slightly simpler and I don't think I broke anything (gives me the same result for my test case anyway). Here is the new version: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > <xsl:output omit-xml-declaration="yes" indent="yes"/> <xsl:variable name="vposArray"> <xsl:value-of select="'|'"/> <xsl:for-each select="/*/record"> <xsl:if test="@type = 'normal'"> <xsl:value-of select="concat(position(), '|')"/> </xsl:if> </xsl:for-each> </xsl:variable> <xsl:template match="@* | node()" name="identity"> <xsl:copy> <xsl:apply-templates select="@* | node()"/> </xsl:copy> </xsl:template> <xsl:template match="records"> <records> <xsl:apply-templates select="record"/> </records> </xsl:template> <xsl:template match="record"> <xsl:variable name="vPos" select="position()"/> <xsl:variable name="vposNext" select="substring-before( substring-after($vposArray, concat('|', position(), '|' ) ), '|' )"/> <xsl:variable name="vNumNested" select="$vposNext - position() - 1"/> <xsl:copy> <xsl:copy-of select="@* | node()"/> <xsl:if test="$vNumNested > 0"> <xsl:copy-of select= "following-sibling::record [position() <= $vNumNested]"/> </xsl:if> </xsl:copy> </xsl:template> <xsl:template match="record[not(@type='normal')]"/> </xsl:stylesheet> Cheers, Raman Gupta 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
|