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 7371 - Propose empty sequence be allowed for $content argument
Summary: Propose empty sequence be allowed for $content argument
Status: CLOSED INVALID
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: Update Facility (show other bugs)
Version: Candidate Recommendation
Hardware: PC Linux
: P2 normal
Target Milestone: ---
Assignee: Jonathan Robie
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL: http://www.w3.org/TR/xquery-update-10...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-08-19 20:30 UTC by Justin Johansson
Modified: 2011-01-08 00:26 UTC (History)
2 users (show)

See Also:


Attachments

Description Justin Johansson 2009-08-19 20:30:13 UTC
This is the first issue that I've logged @ w3c bugzilla so hopefully I'm observing correct protocol.

http://www.w3.org/TR/xquery-update-10/#id-upd-insert-attributes

upd:insertAttributes(
   $target as element(),
   $content as attribute()+)

There are use cases in which $content is computed and the result may be a sequence of zero attributes.  Therefore changing the function signature to the following would obviate the need to test for $content being an empty sequence prior to issuing the function call.

upd:insertAttributes(
   $target as element(),
   $content as attribute()*)

A similar argument applies to the $target argument and accordingly

upd:insertAttributes(
   $target as element()?,
   $content as attribute()*)

is arguably more flexible.

Obviously the above comments are likely to have flow on implications for other upd:* functions to observe argument-wise consistency.

Regards

Justin Johansson
Comment 1 Michael Kay 2009-08-19 20:42:22 UTC
I think this comment would be valid if upd:insertAttributes were designed for use in a user application. However, it's an internal function, and all the places where it is called have the general form:

<quote>
The pending update list consists of the following update primitives:
   1.  If $alist is not empty, upd:insertAttributes($parent, $alist)
</quote>

None of the calls to the function will ever supply an empty $alist, so it doesn't make much difference whether the function signature allows one.
Comment 2 Justin Johansson 2009-08-19 21:28:24 UTC
Thanks for the qualification, Mike.

Case is at the moment I happen to be writing an XQuery Update Facility - compatible/emulation layer for an existing XML database product which has XQuery-only capability but is unlikely to have XQuery Update built into it for quite some time.

So the reason I happened across the issue is that I consulted the Candidate Recommendation only a few hours ago for this very function, so as to understand the functionality required and to copy the signature for my XQuery Update emulator function of the same name (in my emulator namespace).

Then I said to myself, "bugger", I have to check for empty attribute sequence before I can call this one :-)

Given that expert advice is "...so it doesn't make much difference whether the function signature allows one" then it would not be too much of an imposition to accommodate me?  Please.

Thanks, guys.

Comment 3 Michael Kay 2009-08-19 22:00:34 UTC
The functions in the spec are for the purposes of the spec only. You can have any function you like in your implementation.