View Single Post
  #4 (permalink)  
Old November 7th, 2016, 06:02 AM
mhkay's Avatar
mhkay mhkay is offline
Wrox Author
Points: 18,252, Level: 58
Points: 18,252, Level: 58 Points: 18,252, Level: 58 Points: 18,252, Level: 58
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,929
Thanks: 0
Thanked 281 Times in 276 Posts
Default

Yes, you are correct, there is an error in the example.

The string literal written as

Code:
'<&>''"'
is expanded by the XML parser to
Code:
'<&>'"'
and this is what the XPath parser sees. This is not a valid XPath string literal, because of the embedded single apostrophe. To make it into a valid XPath string literal, the apostrophe needs to be doubled. So it can be written as:

Code:
'&lt;&amp;&gt;&apos;&apos;&quot;'
or as

Code:
'&lt;&amp;&gt;''&quot;'
if you prefer.
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
Reply With Quote