This is my Input xml
<para>
<a><b>this is a text</b></a>
</para>
this is my expected output
<para>
this is a text
</para>
how can i delete all the "a" tags and the "b" tags only and the text will not be affected using xslt thanks
This is my Input xml
<para>
<a><b>this is a text</b></a>
</para>
this is my expected output
<para>
this is a text
</para>
how can i delete all the "a" tags and the "b" tags only and the text will not be affected using xslt thanks
<xsl:template match="//para">
<xsl:copy>
<xsl:value-of select="."></xsl:value-of>
</xsl:copy>
</xsl:template>
(or to avoid white space from other child elements:
<xsl:template match="//para">
<xsl:copy>
<xsl:value-of select="./*/*/text()"></xsl:value-of>
</xsl:copy>
</xsl:template>
Start with the identity transformation template
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
then add
<xsl:template match="a | b">
<xsl:apply-templates/>
</xsl:template>
to handle your elements.
Problem Solve..
<xsl:strip-space elements="*"/>
<xsl:template match="*">
<xsl:copy>
<xsl:apply-templates select="node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="//*/text()">
<xsl:if test="normalize-space(.)">
<xsl:value-of select=
"concat(normalize-space(.), '
')"/>
</xsl:if>
<xsl:apply-templates />
</xsl:template>
<xsl:template match="*[not(node())]" />