This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Implementing " and ' in literals


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="&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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]