[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
alex v. wrote:
This stylesheet does what you describe:
<xsl:output method="xml" indent="yes"/>
<xsl:template match="root">
<xsl:copy>
<xsl:for-each-group select="*" group-starting-with="elem[title][preceding-sibling::*[1][not(self::elem[title])]]">
<xsl:copy>
<xsl:copy-of select="title"/>
<xsl:for-each select="current-group()[position() > 1]">
<content><xsl:value-of select="."/></content>
</xsl:for-each>
</xsl:copy>
</xsl:for-each-group>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
--
Re: [xsl] help in xslt2 grouping
Subject: Re: [xsl] help in xslt2 grouping From: Martin Honnen <Martin.Honnen@xxxxxx> Date: Fri, 06 Jul 2007 16:21:21 +0200 |
alex v. wrote:
<root> <elem> <title>row1</title> <content>row2</content> </elem> <elem> <title>row3</title> <content>row4</content> <content>row5</content> <content>row6</content> </elem> </root>
This stylesheet does what you describe:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="root">
<xsl:copy>
<xsl:for-each-group select="*" group-starting-with="elem[title][preceding-sibling::*[1][not(self::elem[title])]]">
<xsl:copy>
<xsl:copy-of select="title"/>
<xsl:for-each select="current-group()[position() > 1]">
<content><xsl:value-of select="."/></content>
</xsl:for-each>
</xsl:copy>
</xsl:for-each-group>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
--
Martin Honnen http://JavaScript.FAQTs.com/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] help in xslt2 grouping, alex v. | Thread | [xsl] Spaces to %20, Kerry Kobashi |
RE: RE: RE: [xsl] Dealing with <![C, cknell | Date | [xsl] Apple Adds exslt:node-set() t, M. David Peterson |
Month |