[xquery-talk] Update bug?

Joseph Bryan joemfb at gmail.com
Tue Oct 6 09:54:40 PDT 2015


Hi Leo,

Try reversing the order of your statements, first inserting the node as a
child of <b/> before deleting it.

Also, you probably don't want to be using // in your selectors, which means
the descendant-or-self axis. With that XPath expression, any @att at any
level of the document would be copied and then deleted. Instead, use exact
paths with a single /, which is the child axis.

insert node doc("xml.xml")/a/@att into doc("xml.xml")/a/b,
delete node doc("xml.xml")/a/@att

Thanks.

-jb

On Tue, Oct 6, 2015 at 12:23 PM, Leo Studer <leo.studer at varioweb.ch> wrote:

> Hello
>
> I am using Oxygen 17.0 with Saxon EE 9.6.0.5 as the xQuery Update
> processor.
>
> I want to move an attribute one level deeper.
>
> In the example I want to move att="att” from <a> to <b>
>
> <?xml version="1.0" encoding="UTF-8"?>
> <a att="att">
>     <b/>
> </a>
>
> Here my code:
>
> *delete* *node* *doc*("xml.xml")//*@att*,
> *insert* *node* *doc*("xml.xml")//*@att* *into **doc*("xml.xml")//*b*
>
> Each of these two statements work correctly alone but when I try both
> together I get java.lang.NullPointerException.
>
> Can anyone explain what happens here?
>
> Thanks in advance
> Leo
>
>
>
>
>
> _______________________________________________
> talk at x-query.com
> http://x-query.com/mailman/listinfo/talk
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://x-query.com/pipermail/talk/attachments/20151006/c1ad5cce/attachment.html>


More information about the talk mailing list