Re: Binding to text nodes

Interesting. I am pretty sure there were discussions about this a long time
ago.

In general, it doesn't make sense to bind controls that *write* data (in
particular, `<xf:input>`) to a text node, as once the text node is gone,
the control will go non-relevant and that's probably not expected behavior.

For controls that just *read* data, I can see some cases where you have
mixed content, for example:

    <foo>
        42
        <bar/>
        43
    </foo>

and bind with:

    <xf:output ref="foo/text()[1]"/>

This is not entirely unreasonable.

-Erik

On Wed, Jun 5, 2019 at 6:18 AM Steven Pemberton <steven.pemberton@cwi.nl>
wrote:

> https://www.w3.org/community/xformsusers/wiki/XForms_2.0#Data_Binding
>
> says:
>
> "A control that reads simpleContent instance data must do so according to
> the type of node it is bound to:
>   * The root node: an xforms-binding-error is dispatched to the control.
>   * Element nodes: If element child nodes are present, then an
> xforms-binding-error is dispatched to the control. Otherwise, the
> string-value of the node is used.
>   * Attribute nodes: the string-value of the node is used.
>   * Text nodes: the string-value of the node is used.
>   * Namespace, processing instruction, and comment nodes: behavior is
> undefined and implementation-dependent."
>
> So binding to text-nodes is explicitely allowed.
>
> Steven
>
>

Received on Wednesday, 5 June 2019 16:10:55 UTC