p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/)
-   BOOK: XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition ISBN: 978-0-470-19274-0 (http://p2p.wrox.com/book-xslt-2-0-xpath-2-0-programmers-reference-4th-edition-isbn-978-0-470-19274-0-398/)
-   -   character-map example on page 948 (http://p2p.wrox.com/book-xslt-2-0-xpath-2-0-programmers-reference-4th-edition-isbn-978-0-470-19274-0/99244-character-map-example-page-948-a.html)

TheovdH November 5th, 2016 07:06 AM

character-map example on page 948
Hi all,

when I try the example on a substitute for

on page 948, I get:

Error at xsl:sequence on line 28 column 122 of auxml2xhtml.xsl:
  XPST0003 XPath syntax error at char 15 on line 28 in {translate($in, '&<>'"}:
    Unmatched quote in expression

(Using Saxon-PE 9.3) Apparently, the line:

  <xsl:sequence select="translate($in, '&lt;&amp;&gt;&apos;&quot;', '&doe-lt;&doe-amp;&doe-gt;&doe-apos;&doe-quot;')"/>
confuses the parser somehow. Assuming the example is correct, what could I be doing wrong here?
Theo van den Heuvel

CitySeven November 5th, 2016 09:21 AM

Maybe the second parameter should have been '&lt;&amp;&gt;''&quot;', as written in pp.532-533.

TheovdH November 5th, 2016 10:12 AM

Thanks CitySeven,
but that implies that there is indeed an error in the example.

mhkay November 7th, 2016 06:02 AM

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

The string literal written as


is expanded by the XML parser to

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:


or as


if you prefer.

All times are GMT -4. The time now is 07:42 AM.

Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
2013 John Wiley & Sons, Inc.