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

Re: Implementing " and ' in literals

Subject: Re: Implementing " and ' in literals
From: Matt Sergeant <matt@xxxxxxxxxxxx>
Date: Thu, 20 Apr 2000 11:17:27 +0100 (BST)
xml literals quot
On Thu, 20 Apr 2000, David Carlisle wrote:

> 
> > In XML::XPath (perl's XPath processing module) I implemented translation
> > of &quot; and &apos; 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="&quot;I'm feeling &amp;quot;sad&amp;quot;&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 &quot;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 &quot;sad&quot;','X', &quot;'&quot;)"/>

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 \&quot; - which
would be far easier to type into an XML editor, and much more friendly,
than typing in &quot; in the XML editor (which would produce the
&amp;quot; that I initially espoused). However that would required
changing all tokenisers - which would be non-trivial, whereas using
&quot; to escape quotes in literals would be a trivial change to XPath
implementations - requiring the equivalent of replace('&quot;', '"') 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

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.