I'm writing XSLT code to parse data from an XML. Value of one element contains single quotation marks which I need to escape. I was trying to do something like this:
<xsl:variable name="text"><xsl:value-of select='desc_text'/></xsl:variable>
<xsl:value-of select="replace($text, ''', '''')"/>
but I get an error: xsl:value-of : could not compile select expression 'replace($text, ''', '''')'
Use <xsl:value-of select="replace($text, "'", "''")"/>
, in XPath 2.0 and later you could also use (see https://www.w3.org/TR/xpath-31/#prod-xpath31-StringLiteral) <xsl:value-of select="replace($text, '''', '''''')"/>
.