Thread: [Xsltforms-support] SVG and XForms
Brought to you by:
alain-couthures
From: Alain C. <ala...@ag...> - 2012-04-02 21:31:40
|
Hello, I have recently embedded XForms controls within SVG images to dynamically render data. For chart axes, I needed a repeat group based on numbers not on nodes so I added an extension to XSLTForms: repeat/@from, repeat/@to and repeat/@step. The loop index can be obtained with the "." XPath expression so the context is not in any model and the instance() function has always to be used when referring to nodes. For pie charts, I needed trigonometric functions, which are only available in XPath 3.0, but are already supported by XSLTForms. For performance, I used an intermediate instance with calculated bindings. I might have implemented the new 'var' element but initially get confused with the 2.0 specs whether vars were limited to function bodies or not. AVT support is, of course, very important for SVG but I also used output controls within text elements. I am not sure that labels in XForms group controls can easily be rendered in SVG. Here are some online examples: http://www.agencexml.com/xsltforms/flags.xml, http://www.agencexml.com/xsltforms/piechart.xml, http://www.agencexml.com/xsltforms/gauges.xml and http://www.agencexml.com/xsltforms/gantt.xml. I would be happy to have your opinions about SVG and XForms. Thanks! -Alain |
From: Nick V. d. B. <Nic...@in...> - 2012-04-03 09:38:42
|
Alain, Nice work! SVG is a really good option if you need vector graphics, and being able to make the graphics dynamic based on user data is really neat, and give another dimension to your documents. We use XSL+FO+SVG to generate dynamic diagrams/charts/drawings, so I'm completly convinced that XForms+SVG is also very powerful and useful. I have a couple small remarks though: 1. Repeat on numbers: In XForms 2.0 we adopt XPath 2.0 and there you can create sequences of numbers using the to operator[1], which allows you to write <xf:repeat ref="1 to 5"> (the current context inside the repeat will hold the atomic value of the current iteration) 2. The var element: If you go to [2] you can read that 'variables can occur either as a child of an action element or somewhere in the document except the model.' with other words variables can occur every where in the document if they are a descendant of an action element or if the are *not* a descendant of the model. There is an editorial note in the spec 'Currently we don't support variables inside the model outside actions, we are waiting for more implementation experience before allowing this.' so if you want to experiment with this please feel free to do it and share your experience. There are currently two possibilities for scoping variables inside the model (available throughout the whole document if the current evaluation context is associated with that model, or only for all following siblings and their descendants) Kind regards, Nick Van den Bleeken R&D Manager Phone: +32 3 425 41 02 Office fax: +32 3 821 01 71 nic...@in... www.inventivedesigners.com 1: http://www.w3.org/TR/xpath-functions/#func-to 2: http://www.w3.org/MarkUp/Forms/wiki/XForms_2.0#The_var_element On 02 Apr 2012, at 23:31, Alain Couthures wrote: > Hello, > > I have recently embedded XForms controls within SVG images to > dynamically render data. > > For chart axes, I needed a repeat group based on numbers not on nodes so > I added an extension to XSLTForms: repeat/@from, repeat/@to and > repeat/@step. The loop index can be obtained with the "." XPath > expression so the context is not in any model and the instance() > function has always to be used when referring to nodes. > > For pie charts, I needed trigonometric functions, which are only > available in XPath 3.0, but are already supported by XSLTForms. > > For performance, I used an intermediate instance with calculated > bindings. I might have implemented the new 'var' element but initially > get confused with the 2.0 specs whether vars were limited to function > bodies or not. > > AVT support is, of course, very important for SVG but I also used output > controls within text elements. I am not sure that labels in XForms group > controls can easily be rendered in SVG. > > Here are some online examples: > http://www.agencexml.com/xsltforms/flags.xml, > http://www.agencexml.com/xsltforms/piechart.xml, > http://www.agencexml.com/xsltforms/gauges.xml and > http://www.agencexml.com/xsltforms/gantt.xml. > > I would be happy to have your opinions about SVG and XForms. > > Thanks! > > -Alain > > > -- > This message has been scanned for viruses and > dangerous content by MailScanner, and is > believed to be clean. > ________________________________ Inventive Designers' Email Disclaimer: http://www.inventivedesigners.com/email-disclaimer |
From: Alain C. <ala...@ag...> - 2012-04-03 19:41:19
|
Nick, > 1. Repeat on numbers: In XForms 2.0 we adopt XPath 2.0 and there you can create sequences of numbers using the to operator[1], which allows you to write<xf:repeat ref="1 to 5"> (the current context inside the repeat will hold the atomic value of the current iteration) > I'm still disturbed by @ref use because a Binding expression should return nodes not a value, am I right? This is what I understand from Orbeon Wiki (http://wiki.orbeon.com/forms/doc/developer-guide/xforms-repeat): Iterating over plain values XForms 1.1 only specifies iterating over instance data nodes (elements or attributes). As of January 2010, Orbeon Forms supports iterating over values, for example: |<xforms:repeat nodeset="(1 to 10)">| |<xforms:output value="position()"/>| |<xforms:output value="."/>| |</xforms:repeat>| In this case, the context item within the repeat is a number, not a node. /NOTE: It is hoped that the XForms specification will include this possibility in the future. Possibly, a new attribute, such as |sequence|, could be proposed, since a sequence of numbers is technically not a node-set!/ ----------------------------------------------------- What do you think? Thanks! -Alain |
From: Jens Ø. P. <oe...@gm...> - 2012-12-29 13:55:31
|
Dear Alain, Do you see why <http://www.agencexml.com/xsltforms/flags.xml> gives an error with WebKit browsers? Best, Jens Begin forwarded message: > From: Alain Couthures <ala...@ag...> > Subject: [Xsltforms-support] SVG and XForms > Date: April 2, 2012 11:31:03 PM GMT+02:00 > To: pub...@w3..., XSLTForms support <xsl...@li...> > > Hello, > > I have recently embedded XForms controls within SVG images to > dynamically render data. > > For chart axes, I needed a repeat group based on numbers not on nodes so > I added an extension to XSLTForms: repeat/@from, repeat/@to and > repeat/@step. The loop index can be obtained with the "." XPath > expression so the context is not in any model and the instance() > function has always to be used when referring to nodes. > > For pie charts, I needed trigonometric functions, which are only > available in XPath 3.0, but are already supported by XSLTForms. > > For performance, I used an intermediate instance with calculated > bindings. I might have implemented the new 'var' element but initially > get confused with the 2.0 specs whether vars were limited to function > bodies or not. > > AVT support is, of course, very important for SVG but I also used output > controls within text elements. I am not sure that labels in XForms group > controls can easily be rendered in SVG. > > Here are some online examples: > http://www.agencexml.com/xsltforms/flags.xml, > http://www.agencexml.com/xsltforms/piechart.xml, > http://www.agencexml.com/xsltforms/gauges.xml and > http://www.agencexml.com/xsltforms/gantt.xml. > > I would be happy to have your opinions about SVG and XForms. > > Thanks! > > -Alain > > ------------------------------------------------------------------------------ > Better than sec? Nothing is better than sec when it comes to > monitoring Big Data applications. Try Boundary one-second > resolution app monitoring today. Free. > http://p.sf.net/sfu/Boundary-dev2dev > _______________________________________________ > Xsltforms-support mailing list > Xsl...@li... > https://lists.sourceforge.net/lists/listinfo/xsltforms-support |
From: Alain C. <ala...@ag...> - 2012-12-29 15:34:39
|
Hello Jens, > Do you see why <http://www.agencexml.com/xsltforms/flags.xml> gives an error with WebKit browsers? > > Thank you for pointing at this exception. It is due to the processing of the xf:include statement (which is an extension...): the document node of the included document is considered for templates. Apparently, WebKit browsers don't treat parameters the same way as others do in this situation. Actually, it is good to directly consider the document element instead. The corresponding fix will be committed as soon as possible. Best, -Alain |