RE: xpath 2.0 comments

 

-----Original Message-----
From: bryan [mailto:bry@itnisk.com] 
Sent: 10 May 2002 13:47
To: public-qt-comments@w3.org
Subject: xpath 2.0 comments


 
Stuff I don't like:
    
    1.  if, for expressions, leave that to scripting technologies, xsl-t
that use xpath.  
 
I'm surprised that you don't recognize the need for conditional expressions
in XPath. Most experienced XSLT users have at some stage hit a problem like
defining a sort key that is @qty if present, or 0 if not. This is very hard
to do in XSLT 1.0. Putting conditional expressions in XPath solves this:
 
<xsl:sort select="if (@qty) then @qty else 0"/>
 
Similarly, most XSLT users have at some stage encountered the need to do
summation of a computed value, the traditional example being totalling
@price times @quantity. The introduction of scalar sequences and for
expressions in XPath solves this nicely:
 
<xsl:value-of select="sum(for $i in item return $i/@price * $i/@qty)"/>
 
It has been argued that 90% of the requirements could be met with a simpler
"for" expression that didn't use range variables, and this is something we
are still considering. But the form with range variables is needed for join
problems, something that arises frequently in "data-oriented" transformation
as distinct from "document-oriented" styling.
 
 
    2. comments, I think this will just increase the illegibility of an
xpath, it's a pretty compact syntax and comments in the middle will do the
opposite of what people hope comments will, i.e improve legibility. Envision
comments in complicated regular expressions. 
 
I'm inclined to agree with you that XSLT users will not often want to put
comments in the middle of XPath expressions. But I don't think that
necessarily makes it a bad feature.
 
    3.  I've been a pain elsewhere talking against the tight integration
with xml schema, this seems to me especially wrong headed. But hell I guess
it's coming. 
 
XML Schema arouses strong feelings. We have worked very hard to make XPath
usable with schemas; we still have some work to do to make sure that it is
also usable without them - but that is definitely our intent. 
 
Michael Kay

Received on Sunday, 12 May 2002 04:59:29 UTC