This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 1527 - Grammar for abbreviated step
Summary: Grammar for abbreviated step
Status: CLOSED WONTFIX
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XPath 2.0 (show other bugs)
Version: Last Call drafts
Hardware: PC Windows XP
: P2 normal
Target Milestone: ---
Assignee: Don Chamberlin
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-07-09 19:12 UTC by Don Chamberlin
Modified: 2005-07-20 17:15 UTC (History)
0 users

See Also:


Attachments

Description Don Chamberlin 2005-07-09 19:12:53 UTC
The syntax for an abbreviated step now looks like this:

AbbrevForwardStep ::= "@"? NodeTest
NodeTest ::= KindTest | NameTest

This allows users to write silly things like this:

@comment()

which looks for a comment node on the attribute axis.
Of course, there is nothing on the attribute axis but attribute nodes, so there 
is no need for a KindTest following "@" in an abbreviated step.

We could eliminate this kind of silliness by changing the grammar as follows:

AbbrevForwardStep ::= NodeTest | "@" NameTest
NodeTest ::= KindTest | NameTest
Comment 1 Michael Kay 2005-07-10 08:14:19 UTC
Please note that XPath 1.0 did not have any "natural" way of expressing an empty
node-set. It is therefore customary for XSLT 1.0 users wanting an empty node-set
(e.g. as a parameter to a template) to write expressions that are guaranteed to
select nothing, such as "/.." or "@comment()". The former is actually
recommended in the XSLT 1.0 specification, and the latter is suggested in at
least one book.

Michael Kay
Comment 2 Don Chamberlin 2005-07-19 16:54:51 UTC
On further thought, it occurs to me that a kind test in the abbreviated syntax 
can be used to search for attributes of a particular type, as in this example:

@attribute(*, xs:date) 

This use case, together with Mike Kay's comments, prompts me to withdraw my 
suggestion for a syntax change. If no one objects, I will mark this comment as 
closed with a resolution of "WONTFIX".

--Don C.
Comment 3 Scott Boag 2005-07-20 14:52:48 UTC
(In reply to comment #2)
> @attribute(*, xs:date) 

I'm not sure what the "@" buys you here.  Why is that different from simply 
    attribute(*, xs:date)
?

FYI, I've tested your proposal and it works fine.  But maybe we should go ahead
and leave it alone, since it would be another XPath 1.0 incompatibility, which I
would like to avoid.

-scott
Comment 4 Don Chamberlin 2005-07-20 17:14:38 UTC
On July 20, 2005, the Query and XSLT working groups voted to close this comment 
without change to specifications.