Re: [xsl] Re: Escaping quotes in XPath expressions

Subject: Re: [xsl] Re: Escaping quotes in XPath expressions
From: David Carlisle <davidc@xxxxxxxxx>
Date: Mon, 17 Nov 2003 13:19:01 GMT
> 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


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

> 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.



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:

 XSL-List info and archive:

Current Thread