Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition ISBN: 978-0-470-19274-0
This is the forum to discuss the Wrox book XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition by Michael Kay; ISBN: 9780470192740
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition ISBN: 978-0-470-19274-0 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old November 5th, 2016, 07:06 AM
Registered User
Points: 8, Level: 1
Points: 8, Level: 1 Points: 8, Level: 1 Points: 8, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2016
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Red face character-map example on page 948

Hi all,

when I try the example on a substitute for
Code:
disable-output-escaping
on page 948, I get:
Code:
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:
Code:
  <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?
Thanks,
Theo van den Heuvel
  #2 (permalink)  
Old November 5th, 2016, 09:21 AM
Registered User
Points: 21, Level: 1
Points: 21, Level: 1 Points: 21, Level: 1 Points: 21, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Feb 2015
Posts: 3
Thanks: 0
Thanked 1 Time in 1 Post
Default

Maybe the second parameter should have been '&lt;&amp;&gt;''&quot;', as written in pp.532-533.
  #3 (permalink)  
Old November 5th, 2016, 10:12 AM
Registered User
Points: 8, Level: 1
Points: 8, Level: 1 Points: 8, Level: 1 Points: 8, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2016
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks CitySeven,
but that implies that there is indeed an error in the example.
TheovdH
  #4 (permalink)  
Old November 7th, 2016, 07:02 AM
mhkay's Avatar
Wrox Author
Points: 18,487, Level: 59
Points: 18,487, Level: 59 Points: 18,487, Level: 59 Points: 18,487, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

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

The string literal written as

Code:
'&lt;&amp;&gt;&apos;&apos;&quot;'
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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Google Maps page not show map. Gladiattor Ajax 2 October 27th, 2014 07:47 PM
Problem with home page map ethan.kapua BOOK: Professional ASP.NET MVC 2 2 March 7th, 2013 05:04 AM
[Page 83] Checking whether the character is Digit/Letter/Whitespace javaKid1337 BOOK: Ivor Horton's Beginning Java, Java 7 Edition 0 May 1st, 2012 05:39 AM
Converting normal text to UTF values using "character map" ROCXY XSLT 1 June 8th, 2011 01:43 PM
Heat Map over Google Map ajit Javascript 0 March 7th, 2008 09:01 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.