default concatenation of strings? BaseX 10.5

Thursday, 6 April 2023 · 3 messages
PD
Patrick Durusau6 Apr 2023 00:02 #

Greetings!

I'm converting Hebrew text, word by word, into code points, which is returned as:

1493 1463 1497 1468 1463 1513 1473 1456 1499 1468 1461 1448 1501

1500 1464 1489 1464 1436 1503

.... (the file is quite long)

What I expect is described at: https://www.w3.org/TR/xslt-xquery-serialization/#sequence-normalization

"If the |item-separator| serialization parameter is absent, then for each subsequence of adjacent strings in /S_2 /, copy a single string to the new sequence equal to the values of the strings in the subsequence concatenated in order, each separated by a single space."

I maybe very wrong but shouldn't that render the strings as?:

1493 1463 1497 1468 1463 1513 1473 1456 1499 1468 1461 1448 1501

and,

1500 1464 1489 1464 1436 1503

I've tried using replace($a, "\n", " ") but it complains that $a is a sequence, which it is.

Then I tried:

for $char in $a

return ($char, " ")

Now I get:

1493

1463

1497

etc.

I saw the new line settings under serialization but there didn't appear to be any way to defeat them altogether.

Thanks!

Patrick

-- Patrick Durusau patrick at durusau.net Technical Advisory Board, OASIS (TAB) Editor, OpenDocument Format TC (OASIS), Project Editor ISO/IEC 26300 Co-Editor, ISO/IEC 13250-1, 13250-5 (Topic Maps) Another Word For It (blog): http://tm.durusau.net Homepage: http://www.durusau.net Twitter: patrickDurusau
LQ
Liam R. E. Quin6 Apr 2023 00:25 #
Quoted text · Patrick Durusau · 9 lines
On Wed, 2023-04-05 at 16:01 -0400, Patrick Durusau wrote: > Greetings! > > I'm converting Hebrew text, word by word, into code points, which is > returned as: > > 1493 > 1463 > 1497

etc

When you say returned as, i am guessing you mean that's what shows up in the BaseX "results" window, which uses "adaptive" serialization.

You could use string-join(your query here, ' ') of course, to make a single string; in that window sequences are shown one item per line.

liam

-- Liam Quin, https://www.delightfulcomputing.com/ Available for XML/Document/Information Architecture/XSLT/ XSL/XQuery/Web/Text Processing/A11Y training, work & consulting. Barefoot Web-slave, antique illustrations: http://www.fromoldbooks.org
PD
Patrick Durusau6 Apr 2023 01:32 #

Liam,

Thanks!

Yes, in the response window and I didn't know it used "adaptive" serialization.

No promises but I hope to remember that!

Hope you are having a great week!

Patrick

Quoted text · Patrick Durusau · 22 lines
On 4/5/23 16:25, Liam R. E. Quin wrote: > On Wed, 2023-04-05 at 16:01 -0400, Patrick Durusau wrote: >> Greetings! >> >> I'm converting Hebrew text, word by word, into code points, which is >> returned as: >> >> 1493 >> 1463 >> 1497 > etc > > When you say returned as, i am guessing you mean that's what shows up > in the BaseX "results" window, which uses "adaptive" serialization. > > You could use string-join(your query here, ' ') of course, to make a > single string; > in that window sequences are shown one item per line. > > > liam >
-- Patrick Durusau patrick at durusau.net Technical Advisory Board, OASIS (TAB) Editor, OpenDocument Format TC (OASIS), Project Editor ISO/IEC 26300 Co-Editor, ISO/IEC 13250-1, 13250-5 (Topic Maps) Another Word For It (blog): http://tm.durusau.net Homepage: http://www.durusau.net Twitter: patrickDurusau

⚡Generated with XQuery