You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Cory Isaacson/CompuFlex <ci...@compuflex.com> on 2000/03/28 01:06:59 UTC

Quotes

I need to translate single quotes to two single quotes in a string.

For example:

SAM'S
SAM''S

Note: This is not a double quote, but two &apos; chars in a row.

I tried using the following:

<xsl:variable name="singleQuote">
  <xsl:text>'</xsl:text>
</xsl:variable>
<xsl:variable name="doubleSingleQuote">
  <xsl:text>''</xsl:text>
</xsl:variable>

<xsl:value-of select="translate($value,$singleQuote,$doubleSingleQuote)"/>


The $value is a variable expression which contains the source data. Everything I try (including using the &apos; entity) doesn't seem to find the ' character and replace it.

Is there an easy way to do this?

Thanks in advance.

Cory