Thanks Alain,
Reading your response, now I think subforms is what I need.
My scenario is a something like a Single Page Application, where the user can select a form template (from a list in the left of the page) and then view the form (in the right pane).
Each form is a different XForms, and must be shown without reloading the page.
Iâll try with subforms and share me results here.
- Bill
De: ***@agencexml.com [mailto:***@agencexml.com]
Enviado el: martes, 21 de octubre de 2014 3:33 p. m.
Para: xsltforms-***@lists.sourceforge.net; William Velasquez
Asunto: Re: [Xsltforms-support] Injecting XSLTForms
Hello William,
The subform mechanism is performing something very similar and, for subforms, the XSLT stylesheet can still be applied client-side.
I also prototyped, some time ago, a way to embed XForms tags within a page being fully assembled by the server. You can find the corresponding Javascript instructions at the very end of the xsltforms.js file. The trick is to add a script element with a type attribute being "text/xforms" (probably not the best value for that purpose, just a prototype...).
I have fixed some issues to be in a commit to come and it sounds like that :
<html>
<head>
<title>Hello World in XForms</title>
</head>
<body>
<p>Type your first name in the input box. <br/>
If you are running XForms, the output should be displayed in the output area.</p>
<script type="text/javascript" src="/xsltforms/trunk/src/xsltforms.js"></script>
<script type="text/xforms">
<xf:model xmlns:xf="http://www.w3.org/2002/xforms">
<xf:instance>
<data xmlns="">
<PersonGivenName/>
</data>
</xf:instance>
</xf:model>
<xf:input xmlns:xf="http://www.w3.org/2002/xforms" ref="PersonGivenName" incremental="true">
<xf:label>Please enter your first name: </xf:label>
</xf:input>
<br />
<xf:output xmlns:xf="http://www.w3.org/2002/xforms" value="concat('Hello ', PersonGivenName, '. We hope you like XForms!')">
<xf:label>Output: </xf:label>
</xf:output>
</script>
</body>
</html>
As you can see, this is not exactly what you are looking for. You should have in mind that there are always two parts resulting from the XSLT transformation: generated Javascript instructions and generated HTML tags. In subform mechanism and, similarly, in the prototype, the result of the transformation is sliced to extract those two parts and, then, they are integrated within the current page.
For a server process, it is not well optimized to have to perform this, each and every time. A solution would be to generate everything with the XSLT transformation and a parameter for this. It might be a document fragment to be inserted or, maybe better, a unique script element to be executed for creating all the form (in this case, the src attribute could even be useful for a dynamic insertion at client side!).
What do you think?
--Alain
Le 20 octobre 2014 à 23:30, William Velasquez <***@visiontecnologica.com<mailto:***@visiontecnologica.com>> a écrit :
Hi folks!
Has anybody successfully injected the result of the XSLTForms transformation into an HTML page?
If the answer is yes, where is the trick? Is necessary to call some javascript initialization?
Iâm doing it via InjectBoundHtml method in Google Polymer, and the DOM is loaded, but the form doesnât run.
Thanks for your ideas,
William David Velásquez
Director de Investigación y Desarrollo
Visión Tecnológica S.A.S.
www.visiontecnologica.com<http://www.visiontecnologica.com>
Tel (57 4) 444 7292
Movil (57) 311 709 8421
Follow me @williamda
------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://p.sf.net/sfu/Zoho_______________________________________________
Xsltforms-support mailing list
Xsltforms-***@lists.sourceforge.net<mailto:Xsltforms-***@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/xsltforms-support