Re: Implementing " and ' in literals

Subject: Re: Implementing " and ' in literals
From: Matt Sergeant <matt@xxxxxxxxxxxx>
Date: Tue, 25 Apr 2000 12:02:06 +0100 (BST)
On Tue, 25 Apr 2000, David Carlisle wrote:

> 
> 
> > Take the following: 'It\'s a nice day'
> 
> > Most (all?) XPath tokenizers simply use the following regular expression:
> 
> > '[^']*'
> 
> > Which with the above, would stop at 'It\', followed by a single NCName
> > token "s" which would cause a syntax error.
> 
> and "\'" would produce ' instead of \' that it produces on conforming systems?

Lets get away from this conforming/non-conforming thing. And consider the
next version of XPath, whatever that may be. But yes. It's a loss in
backward compatibility, and I respect that there may be arguments against
that. But there's no other way I can see to introduce escaping at this
point without breaking any backward compatibility.

> I can't see why you can't use variables, from perl I'd expect that
> that you could assign strings to a variable in _perl_ syntax
> with perl quoting, and then reference that variable by $x in a xpath
> expression.

I can. That's not the issue. I'm thinking about the general case where
someone just wants to mix quoting in XPath without having to use work
arounds. That's what these solutions you keep suggesting are, aren't they?

> This would correspond using xsl syntax to assign variables that you
> could reference in an xpath expression used in xsl.
> 
> Note xpath itself only has a syntax for referring to variables, not for
> assigning them.

I know that. Stupid isn't it? The XPath designers could have at the very
least included a set_var(Literal, Expr) function in the spec. Maybe they
had a good reason not to, but I don't know it.

-- 
<Matt/>

Fastnet Software Ltd. High Performance Web Specialists
Providing mod_perl, XML, Sybase and Oracle solutions
Email for training and consultancy availability.
http://sergeant.org http://xml.sergeant.org


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


Current Thread