[Home] [By Thread] [By Date] [Recent Entries]
Kjellaug Johansen wrote:
Now, I've got another problem. I want a list of Pkt-elements to be wrapped inside a List-element. Assuming you use XSLT 2.0 you can use xsl:for-each-group group-adjacent as follows: <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"> <xsl:output method="xml" indent="yes"/> <xsl:strip-space elements="*"/> <xsl:template match="/test">
<xsl:copy>
<xsl:for-each-group select="*" group-adjacent="boolean(self::Pkt)">
<xsl:choose>
<xsl:when test="current-grouping-key()">
<List>
<xsl:copy-of select="current-group()"/>
</List>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="current-group()"/>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each-group>
</xsl:copy>
</xsl:template></xsl:stylesheet> -- Martin Honnen http://JavaScript.FAQTs.com/
|

Cart



