xs:string(node()) vs node()/text()

3 views
Skip to first unread message

Jarosław Kowalewski

unread,
Feb 9, 2020, 4:29:57 PM2/9/20
to orb...@googlegroups.com

Alessandro Vernet

unread,
Feb 10, 2020, 1:48:39 PM2/10/20
to orb...@googlegroups.com
Hi Jarek,

Interesting question. What you are seeing isn't a bug, and is due to the
difference between the typed value and string value of a node (see 1st link
below).

- When calling `xs:string(…)`, e.g. doing a cast (see 2nd link below), the
atomized value of the parameter is taken, and atomization looks at the typed
value of the node. Since the node of type date, the typed value must be a
date, but since in this case it isn't, you have an error, which stops the
evaluation of the expression.
- When you do `$gaga/text()`, you're accessing the text node inside your
element, which will return whatever is stored inside that element irrelevant
of typing.

A very similar situation happens with booleans, which we discuss in the doc
(see 3rd link below), and of course would happen with any other type. This
isn't trivial, or intuitive (maybe unless you already know about it?!), but
hope it will help.

https://www.w3.org/TR/xpath-30/#id-typed-value
https://www.w3.org/TR/xpath-30/#id-cast
https://doc.orbeon.com/form-builder/formulas/formulas-examples#testing-on-a-yes-no-answer-field

‑Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
--
Sent from: http://discuss.orbeon.com/
Reply all
Reply to author
Forward
0 new messages