Hello --

Using BaseX 10.6, the test query

let $test as xs:string := "And O Lord the pride of man, broken in the dust
again"

let $syntax1 as xs:string :=
analyze-string($test,'\p{Lu}')/(fn:match/concat('[',.,']'),fn:non-match/string())
=> string-join('')

let $syntax2 as xs:string :=
analyze-string($test,'\p{Lu}')/*/(self::fn:match/concat('[',.,']'),self::fn:non-match/string())
=> string-join('')

return ($syntax1,$syntax2)

produces

[A][O][L]nd  ord the pride of man, broken in the dust again
[A]nd [O] [L]ord the pride of man, broken in the dust again

I'm surprised by this, because I expected document order to apply to the
result of analyze-string and for syntax1 to work in the sense of having the
results emerging in the same order as the input.

Have I miscomprehended something?  Anyone care to have a go at explaining
why syntax1 doesn't maintain the order of the input?  (I'm possibly
mistakenly confident that I understand why syntax2 does.)

Thanks!
Graydon

-- 
Graydon Saunders  | graydon...@fastmail.com
Þæs oferéode, ðisses swá mæg.
-- Deor  ("That passed, so may this.")

Reply via email to