[xquery-talk] say how to get "newline" working
andrew.j.welch at gmail.com
Sun Mar 11 01:47:23 PST 2012
> I need to convert to text mode by hand:
> $ basex file.xq|perl -pwle 's/<[^>]+>//g'
> As all text serialization in Xquery can't deal with the same line
> concept... unless one hardwires the line separators (0x0A) in via
> string-join, which doesn't sound much like serialization to me.
There are 2 ways of approaching this, one is a query returning
multiple items that must then be combined somehow outside of the
query, or a query that returns a single item.
Because you've gone with the former, you've now hit a problem of how
those items are being combined. You want newlines, but other people
might want something else, like a single space, or no space at all.
So the easy way, is to just return a single item using string-join.
That said, the code you posted had an output method of html and
returned <td> elements... which suggests you just want indent set?
More information about the talk