Subject: Re: Implementing " and ' in literals From: Matt Sergeant <matt@xxxxxxxxxxxx> Date: Thu, 20 Apr 2000 11:17:27 +0100 (BST) |
On Thu, 20 Apr 2000, David Carlisle wrote: > > > In XML::XPath (perl's XPath processing module) I implemented translation > > of " and ' in literals to " and ' respectively. > > So what do people think of this? > > I think it's completely broken! Only according to the XPath spec. Specs aren't always perfect. > The behaviour of the entities is completely determined by the XML > specification, so if you deviate from that there will be no way of > sharing stylesheets between XML::XPath and a conforming XSL system. That's stretching it a bit - I'm talking about extending the XPath concept of Literals to allow " and ' character escaping, as is available in just about every other language going. > So it adds no new functionality and breaks interoperability. No new functionality is a bit harsh. I wouldn't think people want to use the really long "translate()" method (or concat() methods) just to get something that should be easy to add. > > > > <xsl:value-of select=""I'm feeling &quot;sad&quot;""/> > > > > Which gives you a literal of: > > > I'm feeling "sad" > > The value of the above is the value of the xpath expression > "I'm feeling "sad&;quot;" I was talking about if the above extension was added. > If you want to produce the string I'm feeling "sad" then just use > > <xsl:value-of select="translate('IXm feeling "sad"','X', "'")"/> As an XPath implementor I'm _well_ aware of all the horrid work arounds! Including (but not limited to) translate and concat. But I think we can make life a lot easier for developers by adding in some sort of escaping system. I'm actually more in favour of using \" - which would be far easier to type into an XML editor, and much more friendly, than typing in " in the XML editor (which would produce the &quot; that I initially espoused). However that would required changing all tokenisers - which would be non-trivial, whereas using " to escape quotes in literals would be a trivial change to XPath implementations - requiring the equivalent of replace('"', '"') or whatever function your language uses, in the constructor. -- <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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: Implementing " and ' in literal, Julian Reschke | Thread | Re: Implementing " and ' in literal, David Carlisle |
Re: display in a recursive way, Vikram Sharma | Date | Javascript within XSLT, Nic Williams |
Month |