Actually, i am trying to omit the *namespaces*, not the xml declaration.
Sorry for the mistake in my first post, Martin.
So i am looking for something like : *@exclude-result-prefixes* (as
found in XSLT 3.0).
And indeed, in BaseX (9.5.1), it seems to be a different behaviour if
the xml source is stored in a let variable or in a db. If the xml source
is stored in a variable, the exclusion of prefixes is automatic, as in :
declare namespace marc="http://www.loc.gov/MARC21/slim";
let $xml :=
<marc>
<marc:record xmlns:marc="http://www.loc.gov/MARC21/slim"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<marc:leader>01321nam a22002772a 4500</marc:leader>
<c level="item">
<did>
<unitid type="division">1808001595</unitid>
</did>
</c>
</marc:record>
</marc>
for $record in $xml/marc:record[1]
return
$record/c
which gives a nice :
<c level="item">
<did>
<unitid type="division">1808001595</unitid>
</did>
</c>
Le 25/08/2021 à 16:50, Yann NICOLAS (ABES) a écrit :
Le 25/08/2021 à 15:20, Martin Honnen a écrit :
Am 25.08.2021 um 15:12 schrieb Yann NICOLAS (ABES):
Hi all,
I am looking for the equivalent instruction of XSLT attribute
@omit-xml-declaration in XQuery.
In the Query prolog you can declare
declare namespace output =
"http://www.w3.org/2010/xslt-xquery-serialization";
declare option output:method 'xml';
declare option output:omit-xml-declaration 'yes';
Thanks Martin.
In the user interface, it is working when the xml source is stored in
a let variable, but it's not when the xml source is retrieved from a
BaseX db.
declare namespace marc="http://www.loc.gov/MARC21/slim";
declare namespace output =
"http://www.w3.org/2010/xslt-xquery-serialization";
declare option output:method 'xml';
declare option output:omit-xml-declaration 'yes';
for $record in *db:open('marcxml_full')*//marc:record[1]
return
$record/c