Re: [basex-talk] bug (?) in fn:serialize

2016-09-09 Thread Marc van Grootel
... just checked. When the node is from a document instance than
serialize does keep whitespace (with or without xml:space).

And this clears up a confusion I had about what an element constructor
is and what a direct element constructor is.

For fun I tried serialize(element e { '   ' }) which happily returns 

Somebody wants to write that book on XML/XSLT/XQuery and whitespace?
Title suggestion: "Whitespace matters"

--Marc


Re: [basex-talk] bug (?) in fn:serialize

2016-09-09 Thread Hans-Juergen Rennau
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( )

yiels
 
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 namedxml:space as 
ordinary attributes. Anxml:space attribute does not affect the handling 
ofwhitespace 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]):[Definition: Boundarywhitespace is a sequence of consecutive whitespace 
characterswithin the content of a direct element constructor, that isdelimited 
at each end either by the start or end of the content, orby a 
DirectConstructor, or by anEnclosedExpr. For thispurpose, characters generated 
by character references such as or by CDataSections are not consideredto 
be whitespace characters.]
[1] https://www.w3.org/TR/xquery-31/#id-boundary-space-decls[2] 
https://www.w3.org/TR/xquery-31/#id-whitespace


Alexander Holupirek  schrieb am 11:00 Freitag, 
9.September 2016:
 

 > On 08.09.2016, at 23:17, Hans-Juergen Rennau  wrote:
> 
> Dear BaseX team,
> 
> is this a bug?
> 
> serialize(  ) 
> 
> returns
> 
> 
> 
> I need my blanks!
> 
> Hans-Jürgen

Maybe your data is stored/processed with whitespaces stripped off?

http://docs.basex.org/wiki/Options#CHOP


   

Re: [basex-talk] bug (?) in fn:serialize

2016-09-09 Thread Wiemer, Sebastian
It seems to be a problem with elements containing only whitespace characters:

serialize(
  
Demonstrating the CHOP flag
  
  To be  
   , or not to be 
   dasdf , that is the question.
)

 Tags work as expected, but  Tags will be stripped to the empty element 
.
Maybe this has to do with the handling of empty elements?

Sebastian

> Am 09.09.2016 um 11:00 schrieb Alexander Holupirek :
> 
>> On 08.09.2016, at 23:17, Hans-Juergen Rennau  wrote:
>> 
>> Dear BaseX team,
>> 
>> is this a bug?
>> 
>> serialize(   ) 
>> 
>> returns
>> 
>> 
>> 
>> I need my blanks!
>> 
>> Hans-Jürgen
> 
> Maybe your data is stored/processed with whitespaces stripped off?
> 
> http://docs.basex.org/wiki/Options#CHOP
> 


---
 >>> business. people. technology. <<<
---

adesso AG mit Sitz in Dortmund
Vorstand: Michael Kenfenheuer (Vors.), Christoph Junge, Andreas Prenneis
Vorsitzender des Aufsichtsrates: Prof. Dr. Volker Gruhn
Amtsgericht Dortmund HRB 20663


Re: [basex-talk] bug (?) in fn:serialize

2016-09-09 Thread Marc van Grootel
Hmm first I thought not a bug and that the fix would be to do

serialize(   )

but to my surprise this results in



(with CHOP = false)

That doesn't seem right.

Whereas

serialize()

does what you expect.

--Marc


Re: [basex-talk] bug (?) in fn:serialize

2016-09-09 Thread Alexander Holupirek
> On 08.09.2016, at 23:17, Hans-Juergen Rennau  wrote:
> 
> Dear BaseX team,
> 
> is this a bug?
> 
> serialize(   ) 
> 
> returns
> 
> 
> 
> I need my blanks!
> 
> Hans-Jürgen

Maybe your data is stored/processed with whitespaces stripped off?

http://docs.basex.org/wiki/Options#CHOP



[basex-talk] bug (?) in fn:serialize

2016-09-08 Thread Hans-Juergen Rennau
Dear BaseX team,
is this a bug?
serialize(   ) 

returns

I need my blanks!
Hans-Jürgen