Thank you Christian, changing the argument order does help indeed with the whitespace! The documentation is slightly vague about this.
Unfortunately, I still have not found a way to force BaseX NOT to delete my xml declaration with any update operation on a given input file. For example if I use the same operation in Oxygen, not omitting the declaration is the default behaviour in Saxon EE.
But with BaseX, while I could use fn:put() with a map of serialisation parameters in the return statement, this does not help much because I can not use BaseX functions in my script :-( Is changing this (default) outside the scope of an update script not possible?
BTW I noticed some strange behaviour (this is possibly a bug?) - when CHOP=false in the .basex file and -w switch not set, whitespace does not get chopped (expected) - when CHOP=false in the .basex file and -w switch on the command line, whitespace gets chopped (not expected!)
Thanks, Daniel
-----Ursprüngliche Nachricht----- Von: Christian Grün [mailto:christian.gruen@gmail.com] Gesendet: Freitag, 7. Dezember 2018 17:41 An: Zimmel, Daniel Cc: BaseX Betreff: Re: [basex-talk] Command line options not working with update operation on input file
Hi Daniel.
The argument order is important in BaseX; you could try the following variant:
basex.bat -u -w -ifile.xml -sindent=no update.xquery
If this doesn’t help, you could append the CHOP=true in your .basex configuration file.
Hope this helps Christian
On Fri, Dec 7, 2018 at 3:40 PM Zimmel, Daniel D.Zimmel@esvmedien.de wrote:
Hello,
can anyone give me a hint on the behaviour of the command line options in
BaseX 9.0.2?
When I try an update operation on a file given with "-i", neither the option "-w"
nor any serialisation option gets evaluated; while the update operation with "-u" is working correctly, my whitespace gets happily chopped.
CCL: $ basex.bat -ifile.xml -sindent=no -u -w update.xquery XQ: for $c in doc(document-uri())//element return replace value of node $c with "TEST"
A workaround is using fetch:xml() with document-uri(), which does leave any
whitespace intact and does no indentation (no parameters necessary).
declare variable $doc := document-uri(); for $c in fetch:xml($doc)//element return replace value of node $c with "TEST"
Unfortunately my requirement is I cannot use specific BaseX-functions in this
specific update script.
My XML:
<root> <vs> <kennung>Kennung</kennung> <absatz> <fett>eins</fett> </absatz> <absatz id="sgb04_k_para067_p67_a0001_a0001"> Test <fett>fett</fett>
<kursiv>kursiv</kursiv> Text Text.</absatz>
</vs> </root>
Thanks, Daniel