title: XSLT: Replace single quotes by \'
body: <p>I am using XSLT to transform a XML into a html/php file. In this XSLT I replace some tags by php code and now I have to pass attribute values into that php code. My problem now is that I have to escape single quotes with a backslash to get it work. Is this possible with XSLT.</p>
  
  <p>Example:</p>
  
  <pre><code>&lt;xsl:template match="foo"&gt;
      &lt;xsl:processing-instruction name="php"&gt;$this-&gt;doSomething('&lt;xsl:value-of select="./@bar" /&gt;');&lt;/xsl:processing-instruction&gt;
  &lt;/xsl:template&gt;
  </code></pre>
  
  <p>If I now had a template:</p>
  
  <pre><code>&lt;foo bar="test'xyz"/&gt;
  </code></pre>
  
  <p>This would generate:</p>
  
  <pre><code>&lt;?php $this-&gt;doSomething('test'xyz');?&gt;
  </code></pre>
  
  <p>What I now want to achieve is the following:</p>
  
  <pre><code>&lt;?php $this-&gt;doSomething('test\'xyz');?&gt;
  </code></pre>
  
  <p>So I want to replace all single quotes by \'</p>