The general rules for escaping are:
In 1.0:
- if you want the attribute delimiter in a string literal, use the XML
escape form"
or'
- if you want the string delimiter in a string literal, you’re hosed
In 2.0:
- if you want the attribute delimiter in a string literal, use the XML
escape form"
or'
- if you want the string delimiter in a string literal, double it (for
example, ‘I can”t’)
The use of a variable $quot or $apos as shown by Vitaliy can make the code much clearer.