Question: I intend to use XSLT to clean some unwanted symbols from the following data:

```
<Cart>
    <Row>
        <Ld>Restaurant/Cafe Bar &amp; Stores J-K,3</Ld>
        <Ln>Restaurant/Cafe Bar &amp; Stores J-K</Ln>
    </Row>
</Cart>

```

How can the following symbols be deleted

```
&amp;
/

```

the resulting data would be 

```
<Cart>
    <Row>
        <Ld>Restaurant,Cafe Bar, Stores J-K,3</Ld>
        <Ln>Restaurant, Cafe Bar, Stores J-K</Ln>
    </Row>
</Cart>

```

Answer: 
You can use the [translate()](http://www.w3.org/TR/xpath/#function-translate) function:

Applied to an identity transform to replace those characters with a `,`:

```
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    version="1.0">

    <xsl:template match="@*| node()">
        <xsl:copy>
            <xsl:apply-templates select="@*|node()"/>
        </xsl:copy>
    </xsl:template>

    <xsl:template match="text()">
        <xsl:value-of select="translate(., '&amp;/', ',,')"/>
    </xsl:template>
</xsl:stylesheet>

```

---

With XSLT/XPath 2.0 you can use the [replace()](http://www.w3.org/TR/xpath-functions/#func-replace) function, which provides a more robust capability for find/replace operations and normalization of leading/trailing whitespace, etc.

```
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    version="2.0">

    <xsl:template match="@*| node()">
        <xsl:copy>
            <xsl:apply-templates select="@*|node()"/>
        </xsl:copy>
    </xsl:template>

    <xsl:template match="text()">
        <xsl:value-of select="replace(., '\s?(&amp;|/)\s?', ', ')"/>
    </xsl:template>
</xsl:stylesheet>

```
You can use the [replace](http://www.w3.org/TR/xpath-functions/#func-replace) function.