Subject: Re: [xsl] xsl-grouping two different elements together From: Martin Honnen <Martin.Honnen@xxxxxx> Date: Tue, 16 Mar 2010 16:10:34 +0100 |
given the following structure:
<?xml version="1.0" encoding="UTF-8"?> <kapitel> <abs>first</abs> <einschub1>first_ein</einschub1> <einschub1>second_ein</einschub1> <leerzeile/> <einschub1>third_ein</einschub1> <abs>second</abs> <einschub2>first_ein2</einschub2> <abs>end</abs> </kapitel>
this should transform to:
<?xml version="1.0" encoding="UTF-8"?> <kapitel> <abs>first</abs> <einschub typ="1"> <abs>first_ein</abs> <abs>second_ein</abs> <leerzeile/> <abs>third_ein</abs> </einschub> <abs>second</abs> <einschub typ="2"> <abs>first_ein2</abs> </einschub> <abs>end</abs> </kapitel>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:template match="@* | node()"> <xsl:copy> <xsl:apply-templates select="@*, node()"/> </xsl:copy> </xsl:template>
<xsl:template match="einschub1|einschub2"> <abs> <xsl:apply-templates/> </abs> <xsl:apply-templates select="key('k1', generate-id())"/> </xsl:template>
Martin Honnen http://msmvps.com/blogs/martin_honnen/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] xsl-grouping two differen, gregor FELLENZ | Thread | Re: [xsl] xsl-grouping two differen, gregor FELLENZ |
Re: [xsl] xsl-grouping two differen, David Carlisle | Date | Re: [xsl] xsl-grouping two differen, gregor FELLENZ |
Month |