- From: Alain Couthures <alain.couthures@agencexml.com>
- Date: Thu, 03 May 2012 22:40:37 +0200
- To: XSLTForms support <xsltforms-support@lists.sourceforge.net>, "public-xformsusers@w3.org" <public-xformsusers@w3.org>
Hello,
There is now a new experimental way to use XSLTForms (rev. 542) within
an ordinary HTML page. It should be useful for authors with pages
generated by a CMS for example.
It is based on using an SCRIPT element with @type="text/xforms" to
encapsulate XForms elements (currently, just one SCRIPT element is
supported per page).
A native XSLT engine is required (it won't work with old Android
versions): it is called from Javascript instead of being called from a
processing instruction.
Here is an example:
<html>
<head>
<title>In script test</title>
<script type="text/javascript" src="xsltforms.js">/* */</script>
</head>
<body>
<h1>In script test</h1>
<script type="text/xforms">
<div xmlns="http://www.w3.org/1999/xhtml"
xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<xf:model>
<xf:instance>
<data xmlns="">
<PersonGivenName/>
</data>
</xf:instance>
</xf:model>
<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>
<xf:input ref="PersonGivenName" incremental="true">
<xf:label>Please enter your first name: </xf:label>
</xf:input>
<br/>
<xf:output value="concat('Hello ', PersonGivenName, '. We hope you like
XForms!')">
<xf:label>Output: </xf:label>
</xf:output>
</div>
</script>
</body>
</html>
Thank you for your remarks and comments.
-Alain
Received on Thursday, 3 May 2012 20:41:15 UTC