xsl-list
[Top] [All Lists]

[xsl] translating character references

2009-02-05 06:09:52
Dear All,

My XML is like below:

<m:math>
       <m:mi>&#x03d5;</m:mi>
       <m:mi>&#x03c6;</m:mi>
</m:math>

I want to interchange 3d5 with 3c6 and vice versa and below is my
code. it is not doing the replacement. Please help me how to achieve
this. the solution should be in XSLT 1.0


My xsl is like below:

<xsl:template match="m:mi">
                <xsl:element name="m:mi">
                        <xsl:choose>
                                <xsl:when test="contains(.,'x03d5')">
                                        <xsl:value-of 
select="translate(.,'x03d5','x03c6')"/>
                                </xsl:when>
                                <xsl:when test="contains(.,'x03c6')">
                                        <xsl:value-of 
select="translate(.,'x03c6','x03d5')"/>
                                </xsl:when>
                                <xsl:otherwise>
                                        <xsl:apply-templates/>
                                </xsl:otherwise>
                        </xsl:choose>
                </xsl:element>
        </xsl:template>

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>