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.
Example:
<xsl:template match="foo">
<xsl:processing-instruction name="php">$this->doSomething('<xsl:value-of select="./@bar" />');</xsl:processing-instruction>
</xsl:template>
If I now had a template:
<foo bar="test'xyz"/>
This would generate:
<?php $this->doSomething('test'xyz');?>
What I now want to achieve is the following:
<?php $this->doSomething('test\'xyz');?>
So I want to replace all single quotes by \'