title: How to replace double quotes with single quotes in XSLT?
body: <p>I'm in the process of creating a slideshow using XML data through XSLT.  Part of the process is initializing an array with the title:</p>
  
  <pre><code>item[0] = ["How do I jump?"];
  item[1] = ["I know how to jump!"];
  item[2] = ["Did you read "how to jump""];
  </code></pre>
  
  <p>Notice that the 3rd element has a book title in double quotes?  Well, initializing that element leads to problems with the compilation of the stylesheet (as it should) but is there any way to go about removing the double quotes and replacing them with single quotes?</p>
  
  <pre><code>&lt;xsl:variable name="apos"&gt;&lt;xsl:text&gt;'&lt;/xsl:text&gt;&lt;/xsl:variable&gt;
  &lt;xsl:variable name="double_quote"&gt;&lt;xsl:text&gt;"&lt;/xsl:text&gt;&lt;/xsl:variable&gt;
  
  &lt;xsl:for-each select="/data/calendar/event/title"&gt;  
          &lt;xsl:variable name="index"&gt;
              &lt;xsl:value-of select="position() - 1"/&gt;
          &lt;/xsl:variable&gt;
          &lt;xsl:variable name="safeTitle" select="translate(text(),$double_quote, $apos)" /&gt;&lt;!-- prevents double quotes from being used inside an array using double quotes --&gt;           
          fadetitlesSS12&lt;xsl:value-of select="/data/calendar/id" /&gt;[&lt;xsl:value-of select="$index" /&gt;]=["&lt;xsl:value-of select="$safeTitle" /&gt;"];
      &lt;/xsl:for-each&gt;
  </code></pre>