Re: LC-1565 Use of escape characters in XPath expressions

Dear Rhys,

On 2/4/07, Rhys Lewis <Rhys.Lewis@volantis.com> wrote:
> Dear Mohammed,

My name is Mohamed

>
> Can I just clarify what may be a misunderstanding on my part? I had assumed that your comment about escaping applied equally to all the DISelect documents, (specification, XPath access functions and primer).
>
> However, it seems that your comment is directed specifically at the XPath access functions document. Is that the case?

Yes it is

> If so, then I have misunderstood and I apologise. Also, I think it changes our response to your comment.
>
> To be honest, we've always assumed that the XPath access functions would only ever be used with DISelect markup, and hence would always be embedded in an XML language. Indeed, for a long time the functions and the markup were in the same specification. The examples date from that time.
>
> Now that the documents are split, I do think it reasonable that we should show examples with the syntax for non-XML implementations, but within the XPath functions document only.

That was my point, I didn't make any comment on the other DISelect
specs for the moment.

> However, as the natural home for these functions is within the DISelect markup, I still feel that we should also show the XML syntax.

I still think it is an unnecessary burden and however a limititation
for the future. XPath access is just a mapping of CSS Media Queries to
XPath and I don't find necessary to limit it to XML dialects (what
about using it together with XQuery for example ?)

>
> Would that be a satisfactory conclusion from your point of view?

No, see above

>
> By the way, I don't think your point about escaping the quotes is correct. Only the very special < and > characters need to be escaped when XPath is used in XML languages. This is required by SGML rules. XML is still officially an application of SGML. SGML parsing requires that < and > be recognised as special wherever they occur, even in the middle of strings.

Ok let's be a bit more detailled

if I take this example

dcn:cssmq-width("px", 500) &gt; 400

And if I take the same habit you took on the other DISelect documents
(from the Primer)
<div class="company_item">
     <sel:select>
         <sel:when expr="dcn:cssmq-width('px') &gt; 200">
             <h3 class="company_header"> New York - July 19: Jive
Announces New, High-performance Soccer
                    Boot</h3>
         </sel:when>
         <sel:otherwise>
             <h3 class="company_header"> New, Soccer Boot</h3>
         </sel:otherwise>
     </sel:select>

(or from Content Selection for Device...)

<p>The flooding was quite extensive.</p>
<p sel:expr="dcn:cssmq-width('px') &gt; 200">
    <object src="image1" sel:selid="artimg42"/>
</p>
<p>Many people were evacuated from their homes.</p>


And if just want to copy paste your example


I will get

<p sel:expr="dcn:cssmq-width("px", 500) &gt; 400">
    <object src="image1" sel:selid="artimg42"/>
</p>

which is NOT well formed because QUOTE must be escaped or replaced by APOS
to
<p sel:expr="dcn:cssmq-width(&quot;px&quot;, 500) &gt; 400">
    <object src="image1" sel:selid="artimg42"/>
</p>
or
<p sel:expr="dcn:cssmq-width('px', 500) &gt; 400">
    <object src="image1" sel:selid="artimg42"/>
</p>


That's another point for which I would prefer there is no escaping at all

>
> It's worth noting that XSLT does not require quoting of quotes in its XPath expressions, but it does require quoting of < and >. This is an identical use case to that of DISelect.

Not totally true, see above

>
> Finally, we have implementations of DISelect. When we test the expressions shown in examples they validate correctly as XML documents in the appropriate namespaces.
>
> Best wishes
> Rhys Lewis

Regards,

Mohamed



>
>
>
> -----Original Message-----
> From: public-diselect-editors-request@w3.org [mailto:public-diselect-editors-request@w3.org] On Behalf Of Innovimax SARL
> Sent: 03 February 2007 12:46
> To: Rhys.Lewis@volantis.com
> Cc: public-diselect-editors@w3.org
> Subject: Re: LC-1565 Use of escape characters in XPath expressions
>
>
> Dear diselecters,
>
> Ok here is some examples in Delivery Context: XPath Access Functions 1.0
>
> dcn:cssmq-width("px", 500) &gt; 400
> dcn:cssmq-width("cm") &lt; 2.54
> dcn:cssmq-height("px") &gt; 200
> dcn:cssmq-height("cm", 2.54)
> dcn:cssmq-device-width("px") &lt; 640
> dcn:cssmq-grid()
>
> I don't see any example using AVT's -- you're propably talking about example in 7.1 Using Attribute Value Templates in Content Selection for Device Independence (DISelect) 1.0.
>
> Moreover, if you want to be consistent, you should say that those values have to be put into attributes around APOS ' -- if not it won't be well formed.
>
> That's another point for which I think in Delivery Context: XPath Access Functions 1.0, the XPath expression SHOULD NOT be escaped at all
>
> Best regards,
>
> Mohamed
>
>
>
>
> On 1/31/07, Rhys Lewis <Rhys.Lewis@volantis.com> wrote:
> > Dear Mohammed,
> >
> > It's an interesting approach. Unfortunately, our examples themselves rely on features of the host language, and hence we need to say something about it. For example, we use AVTs to update the class attribute in one example.
> >
> > Since our current expectation is that XML languages will be the ones that implement DISelect, it seems most appropriate to document the syntax that requires escaping.
> >
> > However, a comment about the fact that escaping would not be required in languages that are not XML based could also be helpful. We could certainly add that.
> >
> > As to other W3C documents that describe XPath expressions in XML with examples, the XSLT specification does explicitly use escaping.
> >
> > Very best wishes
> > Rhys
> >
> >
> > -----Original Message-----
> > From: Innovimax SARL [mailto:innovimax@gmail.com]
> > Sent: 31 January 2007 09:45
> > To: Rhys.Lewis@volantis.com
> > Cc: public-diselect-editors@w3.org
> > Subject: Re: LC-1565 Use of escape characters in XPath expressions
> >
> > Dear Rhys,
> >
> > Ok let's try to argument
> >
> > XPath 1.0 has never been targeted to be used ONLY inside XML dialects,
> > and it has been a good idea, since XQuery IS NOT an XML dialect
> >
> > I think that for keeping broader audience for specification,
> > unnecessary limitation should be dropped, especially for an extension
> > of XPath
> >
> > So examples should be given, without escaping
> >
> > I imagine a simple note at the bottom of the specification, which
> > should mention, that "for using it inside an XML dialect such that
> > XHTML, it should be escaped" could be sufficient
> >
> > Regards
> >
> > Mohamed
> >
> > On 1/31/07, Rhys Lewis <Rhys.Lewis@volantis.com> wrote:
> > >
> > >
> > > Dear Mohamed,
> > >
> > > Thanks for the clarification about your comment.
> > >
> > > Our examples are indeed XML, because we assume the host language is
> > > XHTML Version 2. This is stated in the section on Document
> > > Conventions. The text
> > > reads:
> > >
> > > "In the examples, the default namespace, with no prefix, is used to
> > > indicate the host language within which the content selection markup is being used.
> > > The examples assume that the host language is XHTML Version 2 [XHTML 2]."
> > >
> > > Since XHTML Version 2 is an XML-based language, we have applied the
> > > escaping for XPath.
> > >
> > > I hope that this explanation means that you will be able to accept
> > > the disposition of this particular comment.
> > >
> > > Very best wishes
> > >
> > > Rhys Lewis

-- 
Innovimax SARL
Consulting, Training & XML Development
9, impasse des Orteaux
75020 Paris
Tel : +33 8 72 475787
Fax : +33 1 4356 1746
http://www.innovimax.fr
RCS Paris 488.018.631
SARL au capital de 10.000 €

Received on Sunday, 4 February 2007 12:50:43 UTC