I’m writing an XSLT template that need to output a valid xml file for an xml Sitemap.
<url>
<loc>
<xsl:value-of select="umbraco.library:NiceUrl($node/@id)"/>
</loc>
<lastmod>
<xsl:value-of select="concat($node/@updateDate,'+00:00')"/>
</lastmod>
</url>
Unfortunately, Url that is output contains an apostrophe – /what’s-new.aspx
I need to escape the ‘ to ' for google Sitemap. Unfortunately every attempt I’ve tried treats the string ‘'‘ as if it was ”’ which is invalid – frustrating. XSLT can drive me mad sometimes.
Any ideas for a technique? (Assume I can find my way around XSLT 1.0 templates and functions)
So you have
'in your input, but you need the string in your output?In your XSL file, replace
'with&apos;, using this find/replace implementation (unless you are using XSLT 2.0):Call it this way:
The problem is
'is interpreted by XSL as'.&apos;will be interpreted as'.