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 1451 - [XQuery]: Optional indicator in direct element and attribute constructors
Summary: [XQuery]: Optional indicator in direct element and attribute constructors
Status: CLOSED WONTFIX
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XQuery 1.0 (show other bugs)
Version: Last Call drafts
Hardware: PC Linux
: P2 normal
Target Milestone: ---
Assignee: Don Chamberlin
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL: http://lists.w3.org/Archives/Public/p...
Whiteboard:
Keywords: futureConsideration
Depends on:
Blocks:
 
Reported: 2005-05-16 15:25 UTC by C. M. Sperberg-McQueen
Modified: 2005-09-29 18:12 UTC (History)
1 user (show)

See Also:


Attachments

Description C. M. Sperberg-McQueen 2005-05-16 15:25:17 UTC
[Transcribed from comments list by CMSMcQ.  See also the thread beginning
http://lists.w3.org/Archives/Public/public-qt-comments/2005May/0216.html]

This is an enhancement proposal based upon a very frequently encountered
problem among users of our implementation: an external consumer of XML
generated by XQuery does want to have certain empty elements and
attributes to be omitted. 

For example: 
for a query 
<a><b>{()}</b><c foo="{()}"/></a>, 

instead of returning 
<a><b/><c foo=""/></a>

to return 
<a><c/></a>

Producing this result using computed constructors, conditional
statements and custom functions turns out to be quite inelegant,
cumbersome and hard to maintain.

Proposed extension is to add "optional" indicators, using '?' character
("?"?) to the direct element and attribute constructors:

Change production DirElemConstructor to

[94]    DirElemConstructor    ::=    "<" QName "?"? DirAttributeList
("/>" | (">" DirElemContent* "</" QName S? ">")) /* ws: explicit */ 
   

And for 
[95]    DirAttributeList    ::=    (S (QName "?"? S? "=" S?
DirAttributeValue)?)*

When '?' is present, elements with no children should be omitted, and
attributes with value "" should be omitted.

Query in the example would be written

<a><b?>{()}</b><c foo?="{()}"/></a>

To produce <a><c/></a>

Daniel;
Comment 1 Don Chamberlin 2005-06-10 17:29:37 UTC
On May 16, the Query Working Group decided that this request was beyond the 
scope of XQuery Version 1. Your request for new functionality will be 
considered in a future version of XQuery.

Please let us know whether you are satisfied with this resolution of your 
comment.
Comment 2 Daniel Engovatov 2005-09-29 18:05:10 UTC
Should not the bug be kept open against a future version of XQuery?  We would 
not want the issue to be dropped.
Comment 3 Paul Cotton 2005-09-29 18:12:19 UTC
The WG is tracking issues for V.Next and this item will not be dropped.

/paulc