Hi,

it is:

declare option output:method 'xml';
declare option output:indent 'yes’;

doc(“myfile.xml”)


Best,
Giuseppe


Dr. Giuseppe G. A. Celano
DFG-project leader
Universität Leipzig
Institute of Computer Science, NLP
Augustusplatz 10
Tel: +4934132223
04109 Leipzig
Deutschland

E-mail: celano@informatik.uni-leipzig.de
Web site 1: http://asv.informatik.uni-leipzig.de/en/staff/Giuseppe_Celano 
Web site 2: https://sites.google.com/site/giuseppegacelano/




On 17. Nov 2022, at 14:15, Martin Honnen <martin.honnen@gmx.de> wrote:


Am 11/17/2022 um 2:10 PM schrieb Giuseppe G. A. Celano:
Hi,

I am trying to prettyprint an XML file. I tried the serialization option “indent”=“yes”, but it does not work as expected. On BaseX 9, the prettyprint was the default setting: how to get the same result in BaseX 10 (and later)? Thanks.


Can you show us your code?

For me

declare namespace output =
"http://www.w3.org/2010/xslt-xquery-serialization";

declare option output:method 'xml';
declare option output:indent 'yes';

declare context item := <root><foo>bar</foo></root>;

.


gives the result

<root>
  <foo>bar</foo>
</root>


in 10.3.