I have x xml like this,
<doc>
<p>ABC Number 132, Decimal 321, AAB Double 983 DEF GHI 432 JKL</p>
</doc>
what my objective is if 'Number', 'Decimal', 'Double' followed by a space (' ') followed by a number, then that middle space value should be replaced by a * character.
So the output should be,
<doc>
<p>ABC Number*132, Decimal*321, AAB Double*983 DEF GHI 432 JKL</p>
</doc>
I have following xsl for this,
<xsl:template match="p">
<xsl:analyze-string select="text()" regex="(Number/s/d)|(Decimal/s/d)|(Double/s/d)">
<xsl:matching-substring>
<xsl:choose>
<xsl:when test="regex-group(1)">
<xsl:value-of select="'Number*'"/>
</xsl:when>
<xsl:when test="regex-group(2)">
<xsl:value-of select="'Decimal*'"/>
</xsl:when>
<xsl:when test="regex-group(3)">
<xsl:value-of select="'Double*'"/>
</xsl:when>
</xsl:choose>
</xsl:matching-substring>
<xsl:non-matching-substring>
<xsl:value-of select="."/>
</xsl:non-matching-substring>
</xsl:analyze-string>
</xsl:template>
But it does not return the correct result..
Any suggestions how can I modify my code to get the correct output?