[xsl] Creating strings with apos and replacing
My main question is the correct way to use replace() to remove special
characters and spaces that appear in document titles. Some I just want
to remove and others I want to translate to something else.
I have this much working
<xsl:function name="ping:gen_id">
<xsl:param name="INSTRING"/>
<xsl:value-of select="translate(replace(lower-case($INSTRING), ' ',
'_'),
':()','')"/>
</xsl:function>
To the replace I wanted to add the ' character to replace with nothing.
I tried adding \' \\' &apo; '' to no avail.
This iss a sample of a string I'm trying to modify:
"Step 9: Create the application's resource access grant"
So I asked coPilot what should be done and it came up with:
<xsl:template match="/">
<xsl:variable name="inputString" select="'This is a string with a
single quote: 'example''" />
<xsl:variable name="outputString" select="translate($inputString,
'', '')" />
<xsl:value-of select="$outputString" />
</xsl:template>
This throws a different error around creating the inputString.
Unexpected token name "example" beyond end of expression
Which leads to the other part of my question about how you would create
a string variable with an ' in the content. I imagine it will be
the same answer, but wanted to post this for completion of the question.
..dan