XQuery Update delete attributes
Sunday, 27 September 2020 · 4 messages
GD
Günter Dunz-Wolff27 Sep 2020 14:48 #
Hi all,
can’t figure it out. Is there any way in XQuery Update, to delete a specific attribute from any node?
Thanks for help.
Best regards
Günter
MH
Martin Honnen27 Sep 2020 15:13 #
Quoted text · Günter Dunz-Wolff · 3 lines
On 27.09.2020 14:48, Günter Dunz-Wolff wrote: > Hi all, > can’t figure it out. Is there any way in XQuery Update, to delete a specific attribute from any node?
Doesn't
delete node //@foo
delete all "foo" attributes?
Or
. update delete node descendant-or-self::*/@foo
?
Question to Christian: why does
. update delete node descendant-or-self::*/@class
work for me but
/ update delete node descendant-or-self::*/@class
gives an error unexpect end of query.
MH
Martin Honnen27 Sep 2020 15:34 #
Quoted text · Martin Honnen · 12 lines
> > > Question to Christian: why does > > . update delete node descendant-or-self::*/@class > > work for me but > > / update delete node descendant-or-self::*/@class > > gives an error unexpect end of query. >
OK, / update is ambigious, it has to be
(/) update delete node //@class
to make sure the update is not seen as a child node selection of update elements to the root node /.
GD
Günter Dunz-Wolff27 Sep 2020 17:03 #
Hi Martin, delete node //@foo did the job. Thanks.
Written for BaseX 9.4. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery