Could we put the node creation functions back on the agenda for XForms 1.2?

Hi,

Could we put the node creation functions back on the agenda for XForms 1.2?  I ran into the use case of needing to add an attribute to a node, and this simple thing requires a lot of work in XForms.

Assume that you want to add an attribute 'bar' with value 'baz' to the node 'foo'.

First attempt (setvalue):

<xf:setvalue ref="foo/@bar">baz</ xf:setvalue>

-> This fails because the node 'foo/@bar' doesn't exist


Second attempt (insert):

<xf:instance id="template-instance">
  <templates xmlns="" @bar=""/>
</ xf:instance >

<xf:insert context="foo" origin="instance('template-instance')/@bar/>
<xf:setvalue ref="foo/@bar">baz</ xf:setvalue>

-> This is a lot of markup to just add one attribute (insert action, setvalue action and an instance that contains a 'template' of the attribute)


Proposed solution (XPath function that can create an attribute)

<xf:insert context="foo" origin="xf:attribute('bar', 'baz')/>

-> Due to the XForms xpath function attribute() we aren't required to create the extra instance and only have one insert action. Which is quite author friendly, definitely compared to what you have to do now.



(This is a simplification of the real use case I hit today (again), in which the value wasn't a constant value.)

Regards,

Nick Van den Bleeken
R&D Manager

Phone: +32 3 821 01 70
Office Fax: +32 3 821 01 71
nick.van.den.bleeken@inventivegroup.com <mailto:nick.van.den.bleeken@inventivegroup.com>
http://www.inventivedesigners.com<http://www.inventivedesigners.com/>
Linked in<http://be.linkedin.com/in/nvdbleek>


________________________________
Inventive Designers' Email Disclaimer:
http://www.inventivedesigners.com/email-disclaimer

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
--

Received on Wednesday, 21 April 2010 07:55:06 UTC