Dear Hans-Jürgen, When running local:edit() on an in-memory node I get the expected and correct result, including whitespaces. I guess that you run this command on a database node and the XML documents were parsed with CHOP being true (which is the default), this would explain the behavior and would be as expected. If you do not want this you might consider setting the CHOP option (see https://docs.basex.org/wiki/Options#CHOP) to false. Cheers, Dirk On 20/03/14 16:57, Hans-Juergen Rennau wrote:
Dear BaseX team,
I think I observed a bug concerning trailing whitespace in text nodes.
Please consider this input document:
<para>xxx <emphasis role="italic">abc</emphasis> yyy.</para>
[Note the blanks between xxx and <emphasis>.]
The result of the following "null-transformation"
=======================
declare function local:edit($n as node()) as node()? { typeswitch($n) case document-node() return document {for $c in $n/node() return local:edit($c)} case element() return element {node-name($n)} {for $ac in $n/(@*, node()) return local:edit($ac)} default return $n }; local:edit(.) =======================
should be identical, but what I get is this:
<para>xxx<emphasis role="italic">abc</emphasis>yyy.</para>
The blanks after "xxx" are gone!
When transforming mixed content like docbook, this can have awkware consequences.
Kind regards, Hans-Jürgen
_______________________________________________ BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
-- Dirk Kirsten, BaseX GmbH, http://basex.org |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22