Subject: Re: [xsl] Identity Transform with special grouping From: Martin Honnen <Martin.Honnen@xxxxxx> Date: Sat, 05 Feb 2011 09:55:43 +0100 |
My xslt looks for the expected out
<?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="xml" omit-xml-declaration="yes" indent="yes" encoding="UTF-8" />
<!--NO change here is expected, because node names are dynamic in nature--> <xsl:template match="node() | @*"> <xsl:copy> <xsl:apply-templates select="node()| @*"/> </xsl:copy> </xsl:template>
<xsl:template match="header/section[position()< 2]"> <xsl:apply-templates select="@*|node()"/> </xsl:template>
<xsl:template match="section"> </xsl:template> </xsl:stylesheet>
My expected output is <event> <note> </note> <note> </note> <header> <sections> <section> <para1>test</para1> <para1>test</para1> </section> </sections> </header> <payload> <elements/> </payload> </event>
<xsl:output method="xml" omit-xml-declaration="yes" indent="yes" encoding="UTF-8" /> <xsl:strip-space elements="*"/>
<!--NO change here is expected, because node names are dynamic in nature--> <xsl:template match="node() | @*"> <xsl:copy> <xsl:apply-templates select="node()| @*"/> </xsl:copy> </xsl:template>
<xsl:template match="header/section[position() < $n]" > <xsl:apply-templates select="@*|node()"/> </xsl:template>
Martin Honnen http://msmvps.com/blogs/martin_honnen/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Identity Transform with speci, Senthilukvelaan | Thread | [xsl] Re: Identity Transform with s, Senthilukvelaan |
[xsl] Identity Transform with speci, Senthilukvelaan | Date | RE: [xsl] Matching a recursive loca, David Lee |
Month |