Subject: [xsl] Re: Re: Re: Re: Unbounded element grouping/concatenation From: "Gupta, Raman K [CI]" <raman.k.gupta@xxxxxxxxxxxxx> Date: Fri, 12 Dec 2003 15:32:54 -0500 |
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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Re: Re: Re: Re: Unbounded ele, Dimitre Novatchev | Thread | [xsl] Creating namespace and schema, Ed . Trembicki-Guy |
Re: [xsl] <br>-type template match , J.Pietschmann | Date | RE: Re[2]: [xsl] How do you un-esca, Andreas L. Delmelle |
Month |