Thanks, Alexander and everybody for your remarks and observations.
As it happens, in the meantime I've found the reason: it is the boundary-space policy, which can either be "preserve" or "strip" and which a boundary-space declaration of the prolog can explicitly choose (overriding the implementation-defined default) [1]. Therefore:
declare boundary-space preserve;
serialize(<e> </e>)
yiels
<e> </e>
as it should, hurray! One of so many opportunities to note the high quality of BaseX which honours such a rather obscure declaration.
The XQuery spec also states explicitly that xml:space has no effect in this context (from [2]):
"Element constructors treat attributes named
xml:space
as ordinary attributes. An
xml:space
attribute does not affect the handling of
whitespace by an element constructor."
So BaseX is doing just the right thing.
Everything is fine!
Cheers,
Hans-Jürgen
PS: For the interest, here the definition of boundary-whitespace ([2]):
Alexander Holupirek <alex@holupirek.de> schrieb am 11:00 Freitag, 9.September 2016:
> On 08.09.2016, at 23:17, Hans-Juergen Rennau <
hrennau@yahoo.de> wrote:
>
> Dear BaseX team,
>
> is this a bug?
>
> serialize(<e> </e>)
>
> returns
>
> <e/>
>
> I need my blanks!
>
> Hans-Jürgen
Maybe your data is stored/processed with whitespaces stripped off?
http://docs.basex.org/wiki/Options#CHOP