xsl-list
[Top] [All Lists]

RE: [xsl] Can't have both " and ' in an XPath literal

2006-04-23 00:50:21
To all of my knowledge, the XPath 1.0 syntax has no escaping 
mechanism for literal delimiters at all. 

Do I miss something? If no, is this problem still valid for XPath 2.0?

XPath 2.0 allows the delimiter of a string literal to be doubled within the
literal:

xsl:if test='($x = "He said, ""I don't""")'>...

In XSLT 1.0 my usual approach is to use variables

<xsl:variable name="quot">"</xsl:variable>
<xsl:variable name="apos">'</xsl:variable>
<xsl:if test="$x = concat('He said, ', $quot, 'I don', $apos, 't',
$quot)">...

Michael Kay
http://www.saxonica.com/


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--