[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message]

[XQuery Update Newbie] Rename all element nodes (in no namespace) to the same name, but in a namespace?

Ghislain Fourny gfourny at inf.ethz.ch
Sat Feb 20 19:36:24 PST 2010

  [XQuery Update Newbie] Rename all element nodes (in
	no namespace) to the same name
Hi Roger,

This is strange... This output does not seem to be well-formed XML: a namespace declaration is in particular a reserved attribute, and the XML specification says that an element cannot have two attributes with the same name.

Also, something from the XQuery Update Facility specification regarding the upd:rename update primitive is unclear to me: in your original document, there are no bindings at all ("empty prefix" to "no namespace" is not a binding, if I am correct). So, on the one hand, to me the query suggested by Michael Kay is (theoretically) correct and I do not understand why it raises a conflict, given what is in the specification. On the other hand, it makes sense to me that Saxon complains, for the following reason: if no error were raised when renaming an element which is in no namespace to a QName which has a namespace but no prefix (and hence introducing a default namespace binding), then namespace propagation could potentially have the side effect of modifying the QNames of the children (i.e., they would all be in the new namespace) although they are not being renamed... Or am I missing something?

Thanks and kind regards,

> I tried that. This time I didn't get an error message from Saxon. However, the output is not right. On all elements, except the root element, there are two (repeat) namespace declarations:
> <gym:FitnessCenter xmlns:gym="http://www.gym.com">
>    <gym:Member xmlns:gym="http://www.gym.com" xmlns:gym="http://www.gym.com" level="platinum">
>        <gym:Name xmlns:gym="http://www.gym.com" xmlns:gym="http://www.gym.com">Jeff</gym:Name>
>        <gym:FavoriteColor xmlns:gym="http://www.gym.com" xmlns:gym="http://www.gym.com">lightgrey</gym:FavoriteColor>
>    </gym:Member>
>    <gym:Member xmlns:gym="http://www.gym.com" xmlns:gym="http://www.gym.com" level="gold">
>        <gym:Name xmlns:gym="http://www.gym.com" xmlns:gym="http://www.gym.com">David</gym:Name>
>        <gym:FavoriteColor xmlns:gym="http://www.gym.com" xmlns:gym="http://www.gym.com">lightblue</gym:FavoriteColor>
>    </gym:Member>
>    <gym:Member xmlns:gym="http://www.gym.com" xmlns:gym="http://www.gym.com" level="platinum">
>        <gym:Name xmlns:gym="http://www.gym.com" xmlns:gym="http://www.gym.com">Roger</gym:Name>
>        <gym:FavoriteColor xmlns:gym="http://www.gym.com" xmlns:gym="http://www.gym.com">lightyellow</gym:FavoriteColor>
>    </gym:Member>
> </gym:FitnessCenter>
> Any ideas?
> /Roger

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://x-query.com/pipermail/talk/attachments/20100220/82e970cc/attachment.htm


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.