This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
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
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.
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.
The functions in the spec are for the purposes of the spec only. You can have any function you like in your implementation.