Re: XForms, output and SVG live chart

Tangui,

It's a good question: in fact, the Forms working group discussed a
similar situation recently wrt XHTML support for xforms:output.
Basically the question is whether controls can point to complex
content or not, and if so in which circumstances: is this controlled
by the @mediatype attribute, etc. I don't think the group had reached
a final conclusion yet.

In general, XForms controls's so-called "single-node binding" are
restricted to pointing to elements or attributes. But this restriction
is specifically lifted in at least one case:
xforms:select/xforms:select1 that use xforms:copy. In the future,
depending on mediatypes, it could be lifted further.

At the moment, it seems like this is in the realm of specific
implementations supporting both XForms and SVG. How XForms and SVG
deal with each other is not defined by either spec. But an
implementation could certainly experiment with SVG support and lift
that restriction for SVG content, allowing xforms:output to point to
complex content.

-Erik

On Fri, Aug 7, 2009 at 5:35 AM, <tangui.lepense@free.fr> wrote:
> Hi WG,
>
> following advice from this post ( http://groups.google.com/group/mozilla.dev.tech.xforms/browse_thread/thread/0738c4954dc70c80# ), I post here since I have not been able to solve an issue about the output element.
>
> I have been trying to build a form showing a live SVG chart.
>
> http://svground.free.fr/test.xhtml is my last attempt and it does not work since the instance of the use element is not refreshed (and I don't think it should).
>
> My initial idea was to use the output element to display SVG, doing something like that :
>
>      <xf:model>
>         <xf:instance xmlns="http://www.w3.org/2000/svg">
>            <svg version="1.1" baseProfile="full" width="100%" height="100%" xml:lang="fr" viewBox="0 0 400 300" preserveAspectRatio="xMidYMid meet" xmlns:xlink="http://www.w3.org/1999/xlink">
>
>                        <rect id="rect" x="100" y="20" width="30" height="120" fill="lightblue"/>
>
>                        </svg>
>
>         </xf:instance>
>         <xf:bind nodeset="/svg/rect/@width" type="xs:decimal"/>
>      </xf:model>
>
> and further
>
> <xf:range start="10" end="300" incremental="true" ref="/svg/rect/@width">
>     <xf:label>Modify rectangle's width</xf:label>
> </xf:range>
> <xf:output ref="/" mediatype="image/svg+xml">
>     <xf:label>Live chart</xf:label>
> </xf:output>
>
> However, it seems that the ref attribute can only target text content. Example :
>
>         <xf:instance xmlns="http://www.w3.org/2000/svg">
> <![CDATA[
>            <svg version="1.1" baseProfile="full" width="100%" height="100%" xml:lang="fr" viewBox="0 0 400 300" preserveAspectRatio="xMidYMid meet" xmlns:xlink="http://www.w3.org/1999/xlink">
>
>                        <rect id="rect" x="100" y="20" width="30" height="120" fill="lightblue"/>
>
>                        </svg>
> ]]>
>
>         </xf:instance>
>
> To my mind, this is an important restriction since this feature would allow to build live charts and live html tables thanks to repeat features, and more, all without scripting.
>
> Is there a way to do this in the current state of the XForms spec in a declarative way (with no script) ?
>
> Another solution would be to extend the output attribute so that it handles updating attribute, for example something like that :
>
>
> <rect id="rect" x="100" y="20" width="30" height="120" fill="lightblue">
> <xf:output type="attribute" attributeName="width" ref="/instance/value">
> </rect>
>
> Please excuse me if this issue has already been treated on this list and for my low English skills.
>
> Regards,
>
> Tangui Le Pense
>
>
>

Received on Tuesday, 11 August 2009 04:04:29 UTC