[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Re: Escaping quotes in XPath expressions

Subject: Re: Re: Escaping quotes in XPath expressions
From: David Carlisle <davidc@xxxxxxxxx>
Date: Mon, 17 Nov 2003 13:19:01 GMT
xslt escape quotes
> I've read that in XSLT 1.1 the value of a variable *must* be contained in a 'select' 
> attribute, or else you'll be creating a result tree fragment,

You mean xslt 1.0 here (there never was (and never will be) an xslt 1.1
just a draft that was never coompleted to a recommendation)

<xsl:variable name="quot">"</xsl:variable>

is legal xslt 1.0 (creating a result tree fragment) and will be legal
XSLT 2 (creating a node sequence). the terminology has changed but
it doesn't affect the code use here.


> <xsl:variable name="apos" select="'"/>

If you want to do it using select then you need teh Xpath expression "'"
and to put that expression into an XML attribute you need either

select="&quot;'&quot;"
or
select="'"&apos;"'

as that is, in general how to get a string containing " or ' into an XML
attribute.

> Is it an inescapable truth that there's no way to escape special characters within an 
> Xpath string argument? Have I missed something about the creation of variables in 
> XSLT 1.1? Help! :-O

this is in the FAQ for this list.

David


-- 
http://www.dcarlisle.demon.co.uk/matthew

________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.