Hello Habs,
 
First, please let me explain what made a standalone form possible:
 
Because XForms Specifications define their own elements to be mixed within some host language such as HTML, any XForms implementation to be used within a web browser has to HTML elements and attributes. Since XSLTForms 1.5, HTML5 custom elements have replaced plenty of DIVs and SPANs. Such custom elements are immediate images of XForms ones ("xf:*" becoming "xforms-*") but various sub elements had to be been introduced (such as "xforms-body", "xforms-repeat-item", ...) and extra attributes too (such as "xf-bound" which allows CSS styling without _javascript_ instructions). These sub elements and extra attributes are XSLTForms specific and they are added automatically when constructing the form with _javascript_.
 
As a consequence, the new XSLT stylesheet is much lighter and, because XPath parsing is now also performed in _javascript_, it is even faster. Because NodeJS is currently used to develop XSLTForms, a _javascript_ function was easily written to mimic the new transformation from XHTML+XForms to HTML5.
 
This new approach also allows authors to directly write forms in HTML5 pages with an XForms-like syntax so the initial XSLT transformation has not to be performed at client-side (there is always a blank page effect when the browser XSLT engine is running and some browsers don't support XSLT 1.0!) nor at server-side (which has always to be powerful enough for all its clients).
 
BTW, it is now also possible, with _javascript_ only, to read and write local files with file pickers. So, any machine can store files and open them with a browser. With embedded minified "xsltforms.css" and "xsltforms.js", within an HTML5 page with XSLTForms custom elements, a form can be fully executed locally with its own data. Saving modified instances in local files is an option but it could be required to load them back when using the form again. XSLTForms comes with a specific function named "form-source()" to save the source elements of the form with modified instance data into a standalone file to be reopened later.
 
XSLTForms 1.6 does not include a simple form to load an XForms file, transform it to (X)HTML5+custom elements, and save it as a standalone file. Is it what you are looking for?
 
About your questions:
 
1) A standalone form could, as well, be written in XHTML5. It appears that "document.documentElement.outerHTML" (used by the "form-source()" function) is returning serialized well-formed XML for an XHTML5 page: this should work (not tested)!
 
2) Minified "xsltforms.js" and "xsltforms.css" are, of source, lighter but they could be replaced by original ones. If they are in separate local files, it means that the browser has to load them itself. This has not been tested yet but there might security issues blocking this.
These minified sources have not yet been tested for XHTML insertion and issues about <, > and & characters, or CDATA separators, are surely to be fixed. 
 
3) Instance data can be saved, as well, using "resource='file:'" (the _javascript_ File API does not allow to provide a filename to be used but forces use of file pickers).
 
Kind regards,
 
--Alain
Le 23/11/2022 20:44 CET, Habs <[email protected]> a écrit :
 
 
hello supportlist, Alain
 
re: hello-standalone.htm
 
At the moment, I am not understanding well enough the method(s) and
technology used to save the whole form in the above example form supplied
with 1.6, so please forgive me when I ask the following.
 
The example standalone form is HTML (html5).
 
The forms I tend to use are XHTML forms (1.0 strict), using the v1.6
xsltforms.xsl in a processing instruction at the top (client side
transformation) and with the data instance and the styles pulled in from
externally linked files. These forms work well.
 
1) is it possible to replicate the standalone html form example in an
xhtml based form ie. saving the whole xhtml form ?
 
2) if the answer to 1) is yes, then is it possible to put the script and
style sections in separate files (rather than in the xhtml form file) and
if someone has a quick and dirty example that would be excellent ?
 
3) out of interest, is it possible to save just the instance data and not
the whole form in either the standalone example or in the xhtml ?
 
As a test so far, I pinched the 'submission' from the standalone example
and hooked it up in an existing xhtml form to a submit button. I was
expecting that the necessary functionality used directly coded in the
standalone form header, would be in the xsltforms.js via the xsltforms.xsl
transform and would therefore work without much alteration of the existing
xhtml forms used.
 
 
It did not work out, with this error prior to the 'file save' dialogue
being shown, where 'saving' saved nothing:
 
 
XSLTForms Exception
--------------------------
 
Error evaluating the following XPath _expression_ :
 
form-Source()
 
TypeError
 
this.compiled is undefined
 
 
 
In the interim from sending this message, I will create a simplified
bare-bones xhtml and test to see if I can get it to work.
 
What I do know already is that the style and script content in the
standalone example form, leave the xhtml based form as not well-formed ...
even when enclosed in a CDATA block.
 
 
Regards
Habs
 
 
 
--- Sent using Alpine/Pine, probably the best MUA ---
 
 
 
_______________________________________________
Xsltforms-support mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xsltforms-support
_______________________________________________
Xsltforms-support mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xsltforms-support

Reply via email to