|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Recursive grouping won't recurse...
Sorry, to quick to respond. I can see that my first one does not address
your need. This is a tuff one. How about:
<xsl:template match="list">
> <xsl:apply-templates/>
> </xsl:template>
>
> <xsl:template match="a | b | c | d | e | f">
> <xsl:element name="name()">
> <xsl:attribute name="type">
> <xsl:value-of select="@type"/>
> </xsl:attribute>
> <xsl:attribute name="flag">
> <xsl:value-of select="@flag"/>
> </xsl:attribute>
> <xsl:if test="boolean(./*)">
<xsl:for-each select="./*">
<xsl:sort select="@type"/>
<xsl:variable name="prev_sib" select="previous-sibling::*"/>
<xsl:variable name="type" select="@type"/>
<xsl:choose>
<xsl:when test="$type=$prev_sib">
<xsl:apply-templates select="current()"/>
</xsl:when>
<xsl:otherise>
<xsl:call-template name="grouper">
<xsl:with-param name="_type" select="type"/>
</xsl:template>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
<xsl:apply-templates/>> </xsl:if> > </xsl:element> > </xsl:template> <xsl:template name="grouper">
<xsl:param name="_type"/>
<group>
<xsl:apply-temples select="../*[@type=$_type]"/>
</group>
</xsl:template>Robert S. Koberg wrote: Hi Peter, 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
|

Cart








