|
Subject: Re: [xsl] From filepaths to XML hierarchy From: Martin Honnen <Martin.Honnen@xxxxxx> Date: Tue, 27 Dec 2011 14:50:22 +0100 |
Let us reduce the problem to the following input file: <x> <a><b><c/></b></a> <a><b><d/></b></a> <a><b><e/></b></a> <h><i/></h> <h><j/></h> </x>
How can I transform it into the following output: <x> <a><b><c/><d/><e/></b></a> <h><i/><j/></h> </x>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:template match="*">
<xsl:param name="group" select="*"/>
<xsl:copy>
<xsl:for-each-group select="$group" group-by="node-name(.)">
<xsl:apply-templates select=".">
<xsl:with-param name="group" select="current-group()/*"/>
</xsl:apply-templates>
</xsl:for-each-group>
</xsl:copy>
</xsl:template>Martin Honnen --- MVP Data Platform Development http://msmvps.com/blogs/martin_honnen/
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| [xsl] From filepaths to XML hierarc, Jesper Tverskov | Thread | Re: [xsl] From filepaths to XML hie, Jesper Tverskov |
| Re: [xsl] Ordering by child node at, Marc | Date | Re: [xsl] From filepaths to XML hie, Jesper Tverskov |
| Month |