W3C home > Mailing lists > Public > public-xformsusers@w3.org > June 2019

Re: Binding to text nodes

From: Erik Bruchez <ebruchez@orbeon.com>
Date: Wed, 5 Jun 2019 09:10:20 -0700
Message-ID: <CAAc0PEVr5gzgkekKvFfz51hpD2ukAgr3PBO6i+DOSW8Cb5M6AA@mail.gmail.com>
To: Steven Pemberton <steven.pemberton@cwi.nl>
Cc: XForms <public-xformsusers@w3.org>
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

This archive was generated by hypermail 2.3.1 : Wednesday, 5 June 2019 16:10:56 UTC