[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] preceding-sibling::node() apply template -xsl:copy


Subject: [xsl] preceding-sibling::node() apply template -xsl:copy
From: Senthilukvelaan <skumaravelan@xxxxxxxxxxxxxx>
Date: Mon, 16 Apr 2012 18:49:51 -0700

Hi All,
I am using a xslt identity transform and I have one more template to
manipulate "EVENTHEADER" header.
I am not sure ,how to do exclude the  " xmlns:ns2="uri" attribute in
the output using the preceding-sibling::node() apply template.

<ns2:local xmlns:ns2="uri"><EVENTHEADER>


 <xsl:template match="@*|node()">
    <xsl:copy>
       <xsl:apply-templates select="@*|node()"/>
     </xsl:copy>
 </xsl:template>



  <xsl:template match="EVENTHEADER[EVENT_TYPE]">
<xsl:copy>
<xsl:apply-templates select="EVENT_TYPE[position() &lt;
2]/preceding-sibling::node()" />
< EVENT_TYPES>
<xsl:apply-templates select="EVENT_TYPE[position() &lt; 2]" />
</EVENT_TYPES>
<xsl:apply-templates select="EVENT_TYPE[last()]/following-sibling::node()" />
</xsl:copy>
</xsl:template>


Input:
<ns2:local xmlns:ns2="uri"><EVENTHEADER>

Actual output:
<EVENTHEADER  xmlns:ns2="uri">

Expected output:
 <EVENTHEADER>
</EVENTHEADER >

Any pointer would be really helpful.

Thanks
Senthil


Current Thread
Keywords