Subject: Re: [xsl] flatened hiearchies for xslt2 From: David Carlisle <davidc@xxxxxxxxx> Date: Wed, 7 Mar 2007 17:26:29 GMT |
This is a classic for-each-group example: <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="section" name="group"> <xsl:param name="s" select="section"/> <xsl:param name="l" select="1"/> <xsl:for-each-group select="$s" group-starting-with="*[@level=$l]"> <section id="{@id}"> <xsl:call-template name="group"> <xsl:with-param name="s" select="current-group()[position()!=1]"/> <xsl:with-param name="l" select="$l+1"/> </xsl:call-template> </section> </xsl:for-each-group> </xsl:template> </xsl:stylesheet> saxon8 fl.xml fl.xsl \!indent=yes <?xml version="1.0" encoding="UTF-8"?> <section id="1"> <section id="1-1"/> <section id="1-2"> <section id="1-2-1"/> <section id="1-2-2"/> </section> </section> <section id="2"/> David
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] flatened hiearchies for xslt2, ac | Thread | Re: [xsl] flatened hiearchies for x, ac |
[xsl] flatened hiearchies for xslt2, ac | Date | [xsl] Key to select all same nodes(, Tech Guru |
Month |