p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   XSLT (http://p2p.wrox.com/forumdisplay.php?f=86)
-   -   translate (http://p2p.wrox.com/showthread.php?t=54614)

gantait February 27th, 2007 12:19 AM

translate
 
suppose my nodevalue contain a specific string like'"' i want to transform it to any specific char...like '..

with translate i can remove any char now i want to remove
" with ' ..but i can't put ' directly in the function it is showing error..wat is the escapre sequence for '?
translate($varVal,'"',''')...it is showing error

bryanarcher February 27th, 2007 04:15 AM

Hi Gantait,

You can use variables, for example:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    <xsl:variable name="quot">&quot;</xsl:variable>
    <xsl:variable name="apos">&apos;</xsl:variable>
    <xsl:variable name="varVal">&quot; something &quot;</xsl:variable>

    <xsl:template match="/">
        <xsl:value-of select="translate($varVal, $quot, $apos)" /><br />
        <xsl:value-of select="$varVal" />

    </xsl:template>
</xsl:stylesheet>



All times are GMT -4. The time now is 09:44 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.