Using XSL I am trying to turn this XML:
<book><title>This is a <b>great</b> book</title></book>
into this XML:
<book>This is a <bold>great</bold> book</book>
using this xsl:
<xsl:for-each select="book/title/*">
<xsl:choose>
<xsl:when test="name() = 'b'">
<bold>
<xsl:value-of select="text()"/>
</bold>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="text()"/>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
but my output is looking like this:
<book><bold>great</bold></bold>
Can anyone explain why the root text of <title>
is getting lost? I believe my for-each select statement may need to be modified but I can't figure out what is should be.
Keep in mind that I cannot use an <xsl:template match>
because of the complexity of my style sheet.
Thanks!