Greetings,

Running in Basex I get the following error:

XUST0001 <https://www.w3.org/TR/xquery-update-10/#ERRXUST0001> element
constructor: no updating expression allowed.

When trying to insert *insert nodes test as first into $c*

I feel like my code is following the examples
<http://www.xmlmind.com/tutorials/XQueryUpdate/> I see online although
clearly I've got something wrong.

How do I insert a node with a for loop?

declare namespace db="http://basex.org/modules/db";;
declare namespace file="http://expath.org/ns/file";;
declare variable $form13FFileNumber as xs:string external;

let $data := 
db:open('13F')//data[contains(edgarSubmission/formData/coverPage/form13FFileNumber,$form13FFileNumber)]

let $fields :=

<form13FFile>
{
for $c in $data return
insert nodes <b4>test</b4> as first into $c
}
</form13FFile>

return file:write(concat('../OUT/' , $form13FFileNumber , '.xml'), $fields)

To be more clear my xml looks something like

   <data>
     <first_Child>text</first_child>
   </data>
   <data>
     <first_Child>text</first_child>
   </data>

and I would like it to adjust to

<form13FFile>
    <data>
     <b4>test</b4>
     <first_Child>text</first_child>
    </data>
    <data>
     <b4>test</b4>
     <first_Child>text</first_child>
    </data>
</form13FFile>



Regards
Alex
tech.jahtoe.com
bafila.jahtoe.com
_______________________________________________
talk@x-query.com
http://x-query.com/mailman/listinfo/talk

Reply via email to