From: Pedro N. G. R. <p.r...@gm...> - 2010-06-07 08:54:13
|
Hi, I'm not sure if this is the correct place to post post this question. But I didn't find a mail list exclusive for XForms. What I want to do is to show an empty list (let say "persons") and bring the user the oportunity to fill it through the form. ----------------------------------------- <?xml-stylesheet href="xsltforms/xsltforms.xsl" type="text/xsl"?> <?xsltforms-options debug="yes"?> <?oxygen NVDLSchema="../../../../Development/Oxygen%20XML%20Editor%2010/samples/nvdl/xhtml-xforms.nvdl"?> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xf="http://www.w3.org/2002/xforms"> <head> <xf:model> <!-- Main instance. This is what I want to submit --> <xf:instance id="data-to-submit"> <data xmlns=""> <persons /> </data> </xf:instance> <!-- Prototypes --> <xf:instance id="prototypes"> <data xmlns=""> <persons> <person> <name>Modesty Blaise</name> </person> </persons> </data> </xf:instance> <!--A fake submission, just to see what I'm submiting to the server --> <xf:submission id="fake" method="post" replace="instance" action="going-nowhere" /> </xf:model> </head> <body> <ul> <xf:repeat nodeset="instance('data-to-submit')/persons/name"> <li> <xf:output ref="."/> </li> </xf:repeat> </ul> <fieldset> <legend>Add a new entry</legend> <xf:input ref="instance('prototypes')/persons/person[1]/name"> <xf:label>Type a name: </xf:label> </xf:input> <xf:trigger> <xf:label>Add the name</xf:label> <xf:action ev:event="DOMActivate"> <xf:insert nodeset="instance('data-to-submit')/persons" origin="instance('prototypes')/persons/person[1]"/> </xf:action> </xf:trigger> <xf:submit submission="fake"> <xf:label>Submit!</xf:label> </xf:submit> </fieldset> </body> </html> ----------------------------------------------------------- But this doen't work. The resulting data-to-submit instance is like <data xmlns=""> <persons></persons> <person><name>Modesty Blaise</name> </person></data> I do not know how to copy person prototype into the persons node How can achieve that? Thanks in advance, Pedro |