XForms, output and SVG live chart

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 Monday, 10 August 2009 08:15:12 UTC