Discussion:
Injecting XSLTForms
William Velasquez
2014-10-20 21:30:36 UTC
Permalink
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
marcelo alfaro
2014-10-21 12:34:26 UTC
Permalink
Hi William,
what I do is to use XMLStartlet, a little-very-very-useful utility, to
"compile" my xforms into html... That is what is served and used. I've made
a little Makefile that keeps the things more organized but basically what
I do is:

xml tr -E xforms/myxforms.xform > html/myxforms_now_as_html.html

in this case the xsltforms.xsl lives in its own directory xsltforms/ and
is referenced by the xform in the usual way...

<?xml-stylesheet href="../xsltforms/xsltforms.xsl" type="text/xsl"?>

I hope this help

cheers
marcelo


On Mon, Oct 20, 2014 at 6:30 PM, William Velasquez <
Post by William Velasquez
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
Tel (57 4) 444 7292
Movil (57) 311 709 8421
------------------------------------------------------------------------------
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
https://lists.sourceforge.net/lists/listinfo/xsltforms-support
--
+569 7 887 2890
+562 2 378 1264
+562 2 227 3403
a***@public.gmane.org
2014-10-21 20:32:39 UTC
Permalink
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
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
------------------------------------------------------------------------------
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
https://lists.sourceforge.net/lists/listinfo/xsltforms-support
William Velasquez
2014-10-22 16:00:50 UTC
Permalink
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

Loading...