Hi Mark, 
Hi Martin,

yes Martin is right, the whitespace will be chopped by default leading to the 
observed behavior.

If you wanted to preserve whitespace globally, you can do that when creating 
your database. 
If you only want to preserve whitespace for a given element you may do this as 
well:

> let $db := 
> '<text id="test">
>   <clause xml:space="preserve">
>     <word>A</word>a
>     <word>B</word>
>     <word>C</word>c
>   </clause>
> </text>' => parse-xml() (: have to actually parse it for the whitespace 
> preserve to have a an effect :)
> 
> return $db//word/concat(text(), ' ', 
> normalize-space(./following-sibling::text()[1]))

Which returns: 
> A a
> B 
> C c


Best
Michael

> 
> Am 26.02.2019 um 09:48 schrieb Martin Honnen <martin.hon...@gmx.de>:
> 
> 
> I think the result you get is caused by whitespace chopping during XML 
> parsing, seems to be the default, 
> seehttp://docs.basex.org/wiki/Command-Line_Options 
> <http://docs.basex.org/wiki/Command-Line_Options>
> -w    Toggles whitespace chopping of XML text nodes. By default, whitespaces 
> will be chopped.
> 
> 
> 

Reply via email to