Maybe this will help or something like:
declare default element namespace " http://iso.org/OTX/1.0.0 http://iso.org/OTX/1.0.0";
let $newData := for $otx in collection()/otx return
<otx
xmlns=" http://iso.org/OTX/1.0.0 http://iso.org/OTX/1.0.0"
xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance http://www.w3.org/2001/XMLSchema-instance"
xmlns:xmime=" http://www.w3.org/2005/05/xmlmime http://www.w3.org/2005/05/xmlmime"
xmlns:diag=" http://iso.org/OTX/1.0.0/DiagCom http://iso.org/OTX/1.0.0/DiagCom"
xmlns:quant=" http://iso.org/OTX/1.0.0/Quantities http://iso.org/OTX/1.0.0/Quantities"
xmlns:event=" http://iso.org/OTX/1.0.0/Event http://iso.org/OTX/1.0.0/Event"
...
{$otx/@*}
{
$otx/metaData, $otx/specification,$otx/adminData,$otx/imports,
$otx/declarations,
$otx/validities, $otx/signatures,
for $p in $otx/procedures
let $r:= $p/realisation
return $p
}
</otx>
return ( delete node collection()/otx, insert node $newData into collection()/ )
From: basex-talk-bounces@mailman.uni-konstanz.de [mailto:basex-talk-bounces@mailman.uni-konstanz.de] On Behalf Of nguyen my Sent: Tuesday, July 22, 2014 1:32 PM To: basex-talk@mailman.uni-konstanz.de Subject: [basex-talk] Add more namespace to document in baseX
Hello all. I have a problem
I have a document :
<otx xmlns="http://iso.org/OTX/1.0.0" xmlns:math="http://iso.org/OTX/1.0.0/Math">
<..>
</otx>
I want to add more namespace to the otx tag. I use a query is:
declare default element namespace "http://iso.org/OTX/1.0.0";
for $otx in collection()/otx
return replace node $otx with
<otx
xmlns="http://iso.org/OTX/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xmime="http://www.w3.org/2005/05/xmlmime"
xmlns:diag="http://iso.org/OTX/1.0.0/DiagCom"
xmlns:quant="http://iso.org/OTX/1.0.0/Quantities"
xmlns:event="http://iso.org/OTX/1.0.0/Event"
...
{$otx/@*}
{
$otx/metaData, $otx/specification,$otx/adminData,$otx/imports,
$otx/declarations,
$otx/validities, $otx/signatures,
for $p in $otx/procedures
let $r:= $p/realisation
return $p
}
</otx>
but it run very slow if the database is pretty largely.
Please help me for a best solution.
Thanks so much!