Reputation: 44275
I have the following code which appears to be failing.
<xsl:when test="$trialSiteName = 'Physician's Office'">
Also, visual studio is complaining saying
"Expected end of expression, found 's"
How am I supposed to escape the character?
Upvotes: 8
Views: 10363
Reputation: 4544
in between "
you can add what ever special characters you want.
<xsl:when test="$trialSiteName = "Physician's what ever special charactors plainly add Office"">
Upvotes: 1
Reputation: 243459
Much more simple -- use:
<xsl:when test="$trialSiteName = "Physician's Office"">
Upvotes: 9
Reputation: 50947
Declare a variable:
<xsl:variable name="apos" select='"'"'/>
Use the variable like this in the <xsl:when>
clause:
<xsl:when test="$trialSiteName = concat('Physician', $apos, 's Office')">
Upvotes: 7
Reputation: 2487
'
works for XPath 1.0. If you are using XSLT 2.0 with XPath 2.0 try double apostrophe:
<xsl:when test="$trialSiteName = 'Physician''s Office'">
Look for a full explanation by Dimitre Novatchev in his answer Escape single quote in xslt concat function
Upvotes: 0