A very short question about BaseX

Friday, 8 May 2015 · 2 messages
FV
Fabrizio Venerandi8 May 2015 11:34 #
Hi, I’m testing BaseX and I have a very short question about XQuery Update Facility. If I try in other XQuery processor like Saxon a simple query that add a ‘id’ in XML, like this:
xquery version "1.0";
 declare default element namespace "http://www.w3.org/1999/xhtml";

let $sourcedoc := fn:doc("MOST.xhtml")
return
for $ancora at $gatto in $sourcedoc//*[@class="testo"]

return
if (not($ancora/@id)) then
    insert node attribute id {concat("testo",$gatto)} into $ancora
    else()
Saxon run the Query and change the original file, “MOST.xhtml”. If I try the same query in XBase on Ubuntu, I see in the log XBase find the tag to add the id, but the original file is not changed. What I’m missing? Thank you Fabrizio
CG
Christian Grün8 May 2015 12:35 #
Hi Fabrizio, By default, updates will not be written back to documents in the file system. However, this feature can be activated with the -u command-line option [1]. Hope this helps, Christian [1] http://docs.basex.org/wiki/Command-Line_Options#Standalone
Quoted text · Fabrizio Venerandi · 31 lines
On Fri, May 8, 2015 at 11:34 AM, Fabrizio Venerandi <fabrizio.venerandi at quintadicopertina.com> wrote: > Hi, > > I’m testing BaseX and I have a very short question about XQuery Update > Facility. If I try in other XQuery processor like Saxon a simple query that > add a ‘id’ in XML, like this: > > xquery version "1.0"; > declare default element namespace "http://www.w3.org/1999/xhtml"; > > > let $sourcedoc := fn:doc("MOST.xhtml") > return > for $ancora at $gatto in $sourcedoc//*[@class="testo"] > > return > if (not($ancora/@id)) then > insert node attribute id {concat("testo",$gatto)} into $ancora > else() > > > Saxon run the Query and change the original file, “MOST.xhtml”. If I try the > same query in XBase on Ubuntu, I see in the log XBase find the tag to add > the id, but the original file is not changed. What I’m missing? > > > Thank you > > > Fabrizio

⚡Generated with XQuery