Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT 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
 
Old May 21st, 2007, 10:43 AM
Authorized User
 
Join Date: Jul 2006
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default Escape '

   <xsl:value-of select=" ' Above message MUST be sent to when a person&apos;s vehicle is ' "/>

I am trying to have my output say person's. My compiler is giving me a strange error:

W Error in expression. Unexpected <name> beyond end of expression.


I am confused I thought escaping a single quote was common. I thought it was as simple as &apos;. Any have any suggestions?

thanks.

 
Old May 21st, 2007, 11:20 AM
Friend of Wrox
 
Join Date: Jul 2006
Posts: 430
Thanks: 28
Thanked 5 Times in 5 Posts
Send a message via Yahoo to bonekrusher
Default

Hi

lose the <xsl:value-of select and use

<xsl:text>Above message MUST be sent to when a person&apos;s vehicle is</xsl:text>



 
Old May 21st, 2007, 01:26 PM
Authorized User
 
Join Date: Jul 2006
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks.

 
Old May 22nd, 2007, 03:31 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

XML entities are resolved before the XPath parser sets to work, so the XPath parser sees

' Above message MUST be sent to when a person's vehicle is '

which is not a valid string literal. In XPath 2 you can write

' Above message MUST be sent to when a person''s vehicle is '

In XPath 1.0 there's no way of escaping the string delimiter. But you can use

xsl:value-of select='" Above message MUST be sent to when a person&apos;s vehicle is "'

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference





Similar Threads
Thread Thread Starter Forum Replies Last Post
Don't escape the whole thing with CDATA. akentanaka XSLT 2 December 4th, 2008 09:22 PM
Forgotten escape character chrscote Classic ASP Basics 4 December 4th, 2006 09:37 AM
escape squences in C# kapi.goel C# 7 January 10th, 2006 10:24 AM
Escape char for '-' mattastic Access 1 October 6th, 2005 03:27 PM
Need Escape Character? shaileshmark SQL Server 2000 5 July 20th, 2004 12:35 PM





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