Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XSL - Escaping an apostrophe during xsl:when test

Tags:

xslt

I have the following code which appears to be failing.

<xsl:when test="$trialSiteName = 'Physician&apos;s Office'">

Also, visual studio is complaining saying

"Expected end of expression, found 's"

How am I supposed to escape the character?


XSLT v1.0. Apache XSL-FO processor.
like image 334
P.Brian.Mackey Avatar asked Sep 30 '11 16:09

P.Brian.Mackey


2 Answers

Much more simple -- use:

   <xsl:when test="$trialSiteName = &quot;Physician&apos;s Office&quot;">
like image 77
Dimitre Novatchev Avatar answered Nov 04 '22 09:11

Dimitre Novatchev


  1. Declare a variable:

    <xsl:variable name="apos" select='"&apos;"'/>
    
  2. Use the variable like this in the <xsl:when> clause:

    <xsl:when test="$trialSiteName = concat('Physician', $apos, 's Office')">
    
like image 29
mzjn Avatar answered Nov 04 '22 07:11

mzjn