W3C home > Mailing lists > Public > public-qt-comments@w3.org > May 2005

[Bug 1451] New: [XQuery]: Optional indicator in direct element and attribute constructors

From: <bugzilla@wiggum.w3.org>
Date: Mon, 16 May 2005 15:25:17 +0000
To: public-qt-comments@w3.org
Message-Id: <E1DXhT3-0007HS-Jv@wiggum.w3.org>


           Summary: [XQuery]: Optional indicator in direct element and
                    attribute constructors
           Product: XPath / XQuery / XSLT
           Version: Last Call drafts
          Platform: PC
               URL: http://lists.w3.org/Archives/Public/public-qt-
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XQuery
        AssignedTo: chamberl@almaden.ibm.com
        ReportedBy: cmsmcq@w3.org
         QAContact: public-qt-comments@w3.org
                CC: dengovatov@bea.com

[Transcribed from comments list by CMSMcQ.  See also the thread beginning

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 

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?

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>

Received on Monday, 16 May 2005 17:23:55 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 16:57:05 UTC