Cześć, Jaroslwy,

as XML serialization was originally not built for outputting text, the
handling of whitespaces is a little tricky. However, you can benefit
from the new XQuery 3.0 "item-separator" output option:

  declare option output:item-separator '\n';
  concat("text",'
',"additional text"),
  <root><a>element-a</a><b>element-b</b></root>/*/string()

If you want to stick with XQuery 1.0, you can try string-join():

string-join((
  "text", "additional text",
  <root><a>element-a</a><b>element-b</b></root>/*
), '&#10;')
___________________________

On Wed, Jan 2, 2013 at 9:58 PM, Jarosław Kowalewski
<jaroslaw.kowalew...@students.waw.pl> wrote:
> Hi,
>
> I've a problem with concatation strings in for loop.
>
> e.g. xquery
>
>
> concat("text",'&#10;',"additional text"),
> '&#10;',
> '&#10;',
>
> for $i in <root><a>element-a</a><b>element-b</b></root>/*
> return concat($i,'&#10;')
>
>
> give me the result
>
> "
> text
> additional text
>
>  element-a
>  element-b
> "
>
> with additional space before "element-a" and "element-b" but the
> concatation in the first row works fine. I tried it in GUI mode
> version 7.3 and 7.5.
>
> Jarek
> _______________________________________________
> BaseX-Talk mailing list
> BaseX-Talk@mailman.uni-konstanz.de
> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
_______________________________________________
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk

Reply via email to