Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #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
Reply With Quote
  #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.
Reply With Quote
  #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
Reply With Quote
  #4 (permalink)  
Old November 7th, 2016, 06:02 AM
mhkay's Avatar
Wrox Author
Points: 18,179, Level: 58
Points: 18,179, Level: 58 Points: 18,179, Level: 58 Points: 18,179, Level: 58
Activity: 33%
Activity: 33% Activity: 33% Activity: 33%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,921
Thanks: 0
Thanked 278 Times in 273 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
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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 04: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 08:01 AM



All times are GMT -4. The time now is 06:01 AM.


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