XSLT: change node inner text.
Posted
by nabo
on Stack Overflow
See other posts from Stack Overflow
or by nabo
Published on 2010-05-22T16:37:21Z
Indexed on
2010/05/22
16:40 UTC
Read the original article
Hit count: 185
xslt
I need to transform the following xml doc:
<a>
<b/>
<c/>
myText
</a>
into this:
<a>
<b/>
<c/>
differentText
</a>
So, i wrote this XSLT document
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" version="1.0" omit-xml-declaration="no" />
<xsl:template match="/a/text()">
<a>
<b/>
<c/>
differentText
</a>
</xsl:template>
</xsl:stylesheet>
This way, i get the following result:
<?xml version="1.0" encoding="utf-8"?>
<a>
<b /><c />
differentText
</a>
<a>
<b /><c />
differentText
</a>
<a>
<b /><c />
differentText
</a>
The result appears repeated 3 times because 3 matches are being done.. Why? I could i fix it? Thanks
© Stack Overflow or respective owner