Thread: [Xsltforms-support] Download action/control
Brought to you by:
alain-couthures
From: Mats E. <mat...@li...> - 2015-09-21 09:09:21
|
Hi Alain, Somewhat related to my previous question how best leverage HTML 5 Web Workers for async processing in XForms/XsltForms, I now have a similar question, this time related to how best to leverage browsers' capability to allow downloading of resources client-side utilizing the HTML 5 @download attribute on the <a/> element combined with the URL.createObjectURL() method of the File API (http://www.w3.org/TR/FileAPI/#dfn-createObjectURL), and am interested to get your opinion on possible options of extending XsltForms. Obviously it is possible already now to leverage these features in XsltForms via the <xf:load resource="javascript:..."/> or <xf:script/> elements, but I'm thinking this functionality should rather be exposed through and encapsulated in a proper XForms extension element. I was first figuring around the following options: <xf:download ref/value=""/> as a control element, "mirroring" the <xf:upload/> control already part of the XForms specification<xf:download ref/value=""/> as an _action_ element, allowing it to be used in event handlers for the <xf:trigger/> element for example, similar to the <xf:load/> action element. (I'm wondering why the <xf:upload/> wasn't made an action element in XForms as well...?!) At the same time, other options also exist: A custom @appearance attribute on the <xf:output/> element (as in Orbeon Forms: http://wiki.orbeon.com/forms/doc/developer-guide/xforms-controls/output-control?pli=1#TOC-Appearance-xxforms:download)Extended behavior of the <xf:submission resource="file://" method="get/put".../> element... ... What are your thoughts here? Which option would make most sense in your view? Regards,Mats |
From: Mats E. <mat...@li...> - 2016-04-07 21:21:05
|
Hi Alain, Thought I should share with you the solution I arrived at in the end for the problem how best to implement downloading of instances to disk: <xf:load target=”xsltforms:download” xsltforms:filename="data.xml"> <xf:resource value="create-object-url(serialize(instance('data')),'text/xml')"/></xf:load> Regards,Mats Date: Mon, 21 Sep 2015 09:09:13 +0000 Hi Alain, Somewhat related to my previous question how best leverage HTML 5 Web Workers for async processing in XForms/XsltForms, I now have a similar question, this time related to how best to leverage browsers' capability to allow downloading of resources client-side utilizing the HTML 5 @download attribute on the <a/> element combined with the URL.createObjectURL() method of the File API (http://www.w3.org/TR/FileAPI/#dfn-createObjectURL), and am interested to get your opinion on possible options of extending XsltForms. Obviously it is possible already now to leverage these features in XsltForms via the <xf:load resource="javascript:..."/> or <xf:script/> elements, but I'm thinking this functionality should rather be exposed through and encapsulated in a proper XForms extension element. I was first figuring around the following options: <xf:download ref/value=""/> as a control element, "mirroring" the <xf:upload/> control already part of the XForms specification<xf:download ref/value=""/> as an _action_ element, allowing it to be used in event handlers for the <xf:trigger/> element for example, similar to the <xf:load/> action element. (I'm wondering why the <xf:upload/> wasn't made an action element in XForms as well...?!) At the same time, other options also exist: A custom @appearance attribute on the <xf:output/> element (as in Orbeon Forms: http://wiki.orbeon.com/forms/doc/developer-guide/xforms-controls/output-control?pli=1#TOC-Appearance-xxforms:download)Extended behavior of the <xf:submission resource="file://" method="get/put".../> element... ... What are your thoughts here? Which option would make most sense in your view? Regards,Mats |
From: Alain C. <ala...@ag...> - 2016-04-10 18:53:15
|
Hi Mats, From the XForms Recommendation point of view, it is already possible to write an instance to disk using the "file:" protocol. As you know, for security reasons, browser vendors have decided not to allow file writing. XSLTForms includes a small Java applet which can write a file but, again for security reasons, I chose to first display the "Save as" dialog to alert the user and allow him/her to cancel this. XForms submissions have many attributes which can modify the serialization, concerning validation, relevance, for example. I am still perplex about the pertinence of defining submissions within the model: it sounds declarative but it might as well be considered as an action (and the submit action, indeed, has no parameter except the submission id...). Actions are written with an XML notation and I am not, also, that much convinced that a script notation would be worse. Because I am now implementing XQuery 3.1 in Javascript for XSLTForms v2, I am thinking of actions being written in XQuery syntax and annotations to bind XQuery functions to Javascript ones. Different XML-DB implementations already have their own XQuery library modules for standard purposes such as file management. Anyway, I am happy to see that you succeeded in implementing what you need and my current concern is now how new XSLTForms v1 releases might not disturb this... First, you added an attribute to the action: it means you had to modify xsltforms.xsl for generating the corresponding Javascript object. To prevent this, I should better expose all action attributes in the Javascript part not as separate parameters but as named properties (without namespace prefix...) within a unique Javascript object. What do you think? Of course, the load Javascript object in xsltforms.js has been extended... Do you have any idea about how to help you to manage this with next builds? Second, you are using your own functions in expressions. Are they pure Javascript functions or are they added to standard XPath functions. Actually, in both cases, you don't have to modify xsltforms.js, is that correct? Best regards, Alain Le 07/04/2016 23:08, Mats Eklund a écrit : > Hi Alain, > > Thought I should share with you the solution I arrived at in the end > for the problem how best to implement downloading of instances to disk: > > <xf:load target=”xsltforms:download” xsltforms:filename="data.xml"> > <xf:resource > value="create-object-url(serialize(instance('data')),'text/xml')"/> > </xf:load> > > Regards, > Mats > > ------------------------------------------------------------------------ > Date: Mon, 21 Sep 2015 09:09:13 +0000 > > Hi Alain, > > Somewhat related to my previous question how best leverage HTML 5 Web > Workers for async processing in XForms/XsltForms, I now have a similar > question, this time related to how best to leverage browsers' > capability to allow downloading of resources client-side utilizing the > HTML 5 @download attribute on the <a/> element combined with the > URL.createObjectURL() method of the File API > (http://www.w3.org/TR/FileAPI/#dfn-createObjectURL), and am interested > to get your opinion on possible options of extending XsltForms. > > Obviously it is possible already now to leverage these features in > XsltForms via the <xf:load resource="javascript:..."/> or <xf:script/> > elements, but I'm thinking this functionality should rather be exposed > through and encapsulated in a proper XForms extension element. > > I was first figuring around the following options: > > * <xf:download ref/value=""/> as a control element, "mirroring" the > <xf:upload/> control already part of the XForms specification > * <xf:download ref/value=""/> as an _action_ element, allowing it to > be used in event handlers for the <xf:trigger/> element for > example, similar to the <xf:load/> action element. (I'm wondering > why the <xf:upload/> wasn't made an action element in XForms as > well...?!) > > > At the same time, other options also exist: > > * A custom @appearance attribute on the <xf:output/> element (as in > Orbeon Forms: > http://wiki.orbeon.com/forms/doc/developer-guide/xforms-controls/output-control?pli=1#TOC-Appearance-xxforms:download) > * Extended behavior of the <xf:submission resource="file://" > method="get/put".../> element... ... > > > What are your thoughts here? Which option would make most sense in > your view? > > Regards, > Mats > > > > > ------------------------------------------------------------------------------ > > > _______________________________________________ > Xsltforms-support mailing list > Xsl...@li... > https://lists.sourceforge.net/lists/listinfo/xsltforms-support |
From: Mats E. <mat...@li...> - 2016-04-07 21:25:42
|
Hi Alain, Just wanted to share with you, I succeeded with the following: - Allowing XSLTForms to be run as Chrome Apps, with file save/open functionality etc.- Embedding SaxonCE library so that transform() function can run XSLT2 transforms- Adding @async attribute to xf:setvalue/xf:insert elements for non-blocking evaluation of long running XPath expressions in Web Workers- Adding validate-with-xml-schema() function, using xmllint library- Adding validate-with-schematron() function, using SaxonCE. Useful for doing more advanced form validations using SVRL.- Adding parse-xml() function, believe replacing need for xf:setnode Would be glad to contribute these as well as some other extensions and performance optimizations. / Mats |
From: Alain C. <ala...@ag...> - 2016-04-10 19:46:04
|
Hi Mats, > - Allowing XSLTForms to be run as Chrome Apps, with file save/open > functionality etc. Could you please write some documentation about how you succeeded? It might be added in XSLTForms Wikibook, for example. > - Embedding SaxonCE library so that transform() function can run XSLT2 > transforms Have you modified the transform() function so that it is looking at the version of the stylesheet? Could this better be considered as a global option to be added in config files? > - Adding @async attribute to xf:setvalue/xf:insert elements for > non-blocking evaluation of long running XPath expressions in Web Workers Web Workers are not available in old browsers but all recent ones do now! I did not try to use them yet (priorities...) and I still wonder how they can access the XML DOM in the main page: is it a problem?? > - Adding validate-with-xml-schema() function, using xmllint library Is it that Chrome Apps allow you to link C libraries? > - Adding validate-with-schematron() function, using SaxonCE. Useful > for doing more advanced form validations using SVRL. Is it an XPath function? When are you calling it? Before submission? XForms is based on validation at node level whenever a value has been modified: do you think that it is also compatible with SVRL? > - Adding parse-xml() function, believe replacing need for xf:setnode xf:setvalue is there to set a value not to import nodes... That's why I added xf:setnode with the serialized XML string as parameter. In what context do you use parse-xml()? Which document/instance owns the resulting nodes? > > Would be glad to contribute these as well as some other extensions and > performance optimizations. > Will be glad to look at them in details!! Is it your intent to publish source files independently or to fork the repository? Thanks! Alain |
From: <bc...@sh...> - 2016-04-10 20:46:17
|
Hello everyone I've been reading these enhancement suggestions (and others) and I realise that the XForms specification allows for extensions and leaves things open for implementation choices in some areas. My concern -- and I am saying the following (and perhaps with no great qualification to do so) without insinuation that XSLTForms is going this way -- is to ask that careful consideration be paid to sticking to XForms published standards/specification and to watch carefully that the implementation in XSLTForms does not grow into some application full of non-standard and/or deviated approaches to meet a perceived shortcoming. What are your views ? Regards Habs On 10 April 2016 at 20:45, Alain Couthures <ala...@ag...> wrote: > Hi Mats, > > - Allowing XSLTForms to be run as Chrome Apps, with file save/open > functionality etc. > > Could you please write some documentation about how you succeeded? It > might be added in XSLTForms Wikibook, for example. > > - Embedding SaxonCE library so that transform() function can run XSLT2 > transforms > > Have you modified the transform() function so that it is looking at the > version of the stylesheet? Could this better be considered as a global > option to be added in config files? > > - Adding @async attribute to xf:setvalue/xf:insert elements for > non-blocking evaluation of long running XPath expressions in Web Workers > > Web Workers are not available in old browsers but all recent ones do now! > I did not try to use them yet (priorities...) and I still wonder how they > can access the XML DOM in the main page: is it a problem?? > > - Adding validate-with-xml-schema() function, using xmllint library > > Is it that Chrome Apps allow you to link C libraries? > > - Adding validate-with-schematron() function, using SaxonCE. Useful for > doing more advanced form validations using SVRL. > > Is it an XPath function? When are you calling it? Before submission? > XForms is based on validation at node level whenever a value has been > modified: do you think that it is also compatible with SVRL? > > - Adding parse-xml() function, believe replacing need for xf:setnode > > xf:setvalue is there to set a value not to import nodes... That's why I > added xf:setnode with the serialized XML string as parameter. In what > context do you use parse-xml()? Which document/instance owns the resulting > nodes? > > > Would be glad to contribute these as well as some other extensions and > performance optimizations. > > Will be glad to look at them in details!! Is it your intent to publish > source files independently or to fork the repository? > > Thanks! > > Alain > > > ------------------------------------------------------------------------------ > Find and fix application performance issues faster with Applications > Manager > Applications Manager provides deep performance insights into multiple > tiers of > your business applications. It resolves application problems quickly and > reduces your MTTR. Get your free trial! http://pubads.g.doubleclick.net/ > gampad/clk?id=1444514301&iu=/ca-pub-7940484522588532 > _______________________________________________ > Xsltforms-support mailing list > Xsl...@li... > https://lists.sourceforge.net/lists/listinfo/xsltforms-support > > |
From: Alain C. <ala...@ag...> - 2016-04-10 21:06:24
|
Hello Habs, A pragmatic approach is important: XForms recommendation cannot be seen as a definitive solution for everything. It is important to know what is missing in it, thanks to authors feedback. Comparing to Orbeon, XSLTForms has much less extensions... Each of them have been analyzed in details in recommendation spirit. The main point is how to standardize approaches. Contributions are welcome in XForms Users Community Group (https://www.w3.org/community/xformsusers/)! Regards, Alain Le 10/04/2016 22:14, bc...@sh... a écrit : > Hello everyone > > I've been reading these enhancement suggestions (and others) and I > realise that the XForms specification allows for extensions and leaves > things open for implementation choices in some areas. > > My concern -- and I am saying the following (and perhaps with no great > qualification to do so) without insinuation that XSLTForms is going > this way -- is to ask that careful consideration be paid to sticking > to XForms published standards/specification and to watch carefully > that the implementation in XSLTForms does not grow into some > application full of non-standard and/or deviated approaches to meet a > perceived shortcoming. > > What are your views ? > > Regards > Habs > > On 10 April 2016 at 20:45, Alain Couthures > <ala...@ag... <mailto:ala...@ag...>> > wrote: > > Hi Mats, > >> - Allowing XSLTForms to be run as Chrome Apps, with file >> save/open functionality etc. > Could you please write some documentation about how you succeeded? > It might be added in XSLTForms Wikibook, for example. >> - Embedding SaxonCE library so that transform() function can run >> XSLT2 transforms > Have you modified the transform() function so that it is looking > at the version of the stylesheet? Could this better be considered > as a global option to be added in config files? >> - Adding @async attribute to xf:setvalue/xf:insert elements for >> non-blocking evaluation of long running XPath expressions in Web >> Workers > Web Workers are not available in old browsers but all recent ones > do now! I did not try to use them yet (priorities...) and I still > wonder how they can access the XML DOM in the main page: is it a > problem?? >> - Adding validate-with-xml-schema() function, using xmllint library > Is it that Chrome Apps allow you to link C libraries? >> - Adding validate-with-schematron() function, using SaxonCE. >> Useful for doing more advanced form validations using SVRL. > Is it an XPath function? When are you calling it? Before > submission? XForms is based on validation at node level whenever a > value has been modified: do you think that it is also compatible > with SVRL? >> - Adding parse-xml() function, believe replacing need for xf:setnode > xf:setvalue is there to set a value not to import nodes... That's > why I added xf:setnode with the serialized XML string as > parameter. In what context do you use parse-xml()? Which > document/instance owns the resulting nodes? >> >> Would be glad to contribute these as well as some other >> extensions and performance optimizations. >> > Will be glad to look at them in details!! Is it your intent to > publish source files independently or to fork the repository? > > Thanks! > > Alain > > ------------------------------------------------------------------------------ > Find and fix application performance issues faster with > Applications Manager > Applications Manager provides deep performance insights into > multiple tiers of > your business applications. It resolves application problems > quickly and > reduces your MTTR. Get your free trial! > http://pubads.g.doubleclick.net/ > gampad/clk?id=1444514301&iu=/ca-pub-7940484522588532 > <http://pubads.g.doubleclick.net/%0Agampad/clk?id=1444514301&iu=/ca-pub-7940484522588532> > _______________________________________________ > Xsltforms-support mailing list > Xsl...@li... > <mailto:Xsl...@li...> > https://lists.sourceforge.net/lists/listinfo/xsltforms-support > > |
From: <bc...@sh...> - 2016-04-11 08:56:47
|
Hi Alain Pragmatism is an interesting concept at times :-) Any way, I was in no way suggesting stifling development if that is how you read my comment; it was just a high level point of principle consideration, to exercise trusted approaches and principles and ensure agreed standards and consistency (whatever that all means) and to avoid pitfalls. As I stated, I am not insinuating XSLTForms currently is any of what I said; nor was I doing any comparison. It is all good. Peace and good will. Regards Habs On 10 April 2016 at 22:06, Alain Couthures <ala...@ag...> wrote: > Hello Habs, > > A pragmatic approach is important: XForms recommendation cannot be seen as > a definitive solution for everything. It is important to know what is > missing in it, thanks to authors feedback. > > Comparing to Orbeon, XSLTForms has much less extensions... Each of them > have been analyzed in details in recommendation spirit. > > The main point is how to standardize approaches. Contributions are welcome > in XForms Users Community Group (https://www.w3.org/community/xformsusers/ > )! > > Regards, > > Alain > > Le 10/04/2016 22:14, bc...@sh... a écrit : > > Hello everyone > > I've been reading these enhancement suggestions (and others) and I realise > that the XForms specification allows for extensions and leaves things open > for implementation choices in some areas. > > My concern -- and I am saying the following (and perhaps with no great > qualification to do so) without insinuation that XSLTForms is going this > way -- is to ask that careful consideration be paid to sticking to XForms > published standards/specification and to watch carefully that the > implementation in XSLTForms does not grow into some application full of > non-standard and/or deviated approaches to meet a perceived shortcoming. > > What are your views ? > > Regards > Habs > > On 10 April 2016 at 20:45, Alain Couthures <ala...@ag...> > wrote: > >> Hi Mats, >> >> - Allowing XSLTForms to be run as Chrome Apps, with file save/open >> functionality etc. >> >> Could you please write some documentation about how you succeeded? It >> might be added in XSLTForms Wikibook, for example. >> >> - Embedding SaxonCE library so that transform() function can run XSLT2 >> transforms >> >> Have you modified the transform() function so that it is looking at the >> version of the stylesheet? Could this better be considered as a global >> option to be added in config files? >> >> - Adding @async attribute to xf:setvalue/xf:insert elements for >> non-blocking evaluation of long running XPath expressions in Web Workers >> >> Web Workers are not available in old browsers but all recent ones do now! >> I did not try to use them yet (priorities...) and I still wonder how they >> can access the XML DOM in the main page: is it a problem?? >> >> - Adding validate-with-xml-schema() function, using xmllint library >> >> Is it that Chrome Apps allow you to link C libraries? >> >> - Adding validate-with-schematron() function, using SaxonCE. Useful for >> doing more advanced form validations using SVRL. >> >> Is it an XPath function? When are you calling it? Before submission? >> XForms is based on validation at node level whenever a value has been >> modified: do you think that it is also compatible with SVRL? >> >> - Adding parse-xml() function, believe replacing need for xf:setnode >> >> xf:setvalue is there to set a value not to import nodes... That's why I >> added xf:setnode with the serialized XML string as parameter. In what >> context do you use parse-xml()? Which document/instance owns the resulting >> nodes? >> >> >> Would be glad to contribute these as well as some other extensions and >> performance optimizations. >> >> Will be glad to look at them in details!! Is it your intent to publish >> source files independently or to fork the repository? >> >> Thanks! >> >> Alain >> >> >> ------------------------------------------------------------------------------ >> Find and fix application performance issues faster with Applications >> Manager >> Applications Manager provides deep performance insights into multiple >> tiers of >> your business applications. It resolves application problems quickly and >> reduces your MTTR. Get your free trial! >> <http://pubads.g.doubleclick.net/%0Agampad/clk?id=1444514301&iu=/ca-pub-7940484522588532> >> http://pubads.g.doubleclick.net/ >> gampad/clk?id=1444514301&iu=/ca-pub-7940484522588532 >> _______________________________________________ >> Xsltforms-support mailing list >> Xsl...@li... >> https://lists.sourceforge.net/lists/listinfo/xsltforms-support >> >> > > |
From: Mats E. <mat...@li...> - 2016-04-11 21:43:46
|
Hi Alain, Thanks for your feedback! The option of extending the xf:load action seemed to be the most natural option in the end. It's quite similar to how download actions are written in HTML 5, and basically corresponds to option #2 in my initial posting on the topic, however, leveraging the existing XForms xf:load element and the standard extensibility slots instead of inventing a non-standard download element. Both option #3 and #4 seemed unnatural for the task in the end. With the numerous other extensions I had to do in my project I (temporarily) gave up the ability to do easy upgrades in the future. I may try to recover it at some point. For this one I had to do slight modifications to both xsltforms.xsl and xsltforms.js. However, this particular extension could probably be implemented in more of plug-in manner if extension attributes were exposed to script methods, as you suggest. In my implementation I also allow the filename parameter to be specified via either an attribute or a child element (similar to the resource attribute), but I guess this could still be catered for in some generic way. My custom XPath function "create-object-url(string-object, mediatype, encoding, lifetime)", which basically mimics the URL.createObjectURL() Javascript function, was necessary to add in order to make this work. It came in handy to solve some other problems as well. Such extensions to XSLTForms' XPath functions library are currently easy to add/plug-in. Like it should be! Kind regards,Mats On Sun, 10 Apr 2016 20:53:01 +0200 ala...@ag... wrote : Hi Mats, From the XForms Recommendation point of view, it is already possible to write an instance to disk using the "file:" protocol. As you know, for security reasons, browser vendors have decided not to allow file writing. XSLTForms includes a small Java applet which can write a file but, again for security reasons, I chose to first display the "Save as" dialog to alert the user and allow him/her to cancel this. XForms submissions have many attributes which can modify the serialization, concerning validation, relevance, for example. I am still perplex about the pertinence of defining submissions within the model: it sounds declarative but it might as well be considered as an action (and the submit action, indeed, has no parameter except the submission id...). Actions are written with an XML notation and I am not, also, that much convinced that a script notation would be worse. Because I am now implementing XQuery 3.1 in Javascript for XSLTForms v2, I am thinking of actions being written in XQuery syntax and annotations to bind XQuery functions to Javascript ones. Different XML-DB implementations already have their own XQuery library modules for standard purposes such as file management. Anyway, I am happy to see that you succeeded in implementing what you need and my current concern is now how new XSLTForms v1 releases might not disturb this... First, you added an attribute to the action: it means you had to modify xsltforms.xsl for generating the corresponding Javascript object. To prevent this, I should better expose all action attributes in the Javascript part not as separate parameters but as named properties (without namespace prefix...) within a unique Javascript object. What do you think? Of course, the load Javascript object in xsltforms.js has been extended... Do you have any idea about how to help you to manage this with next builds? Second, you are using your own functions in expressions. Are they pure Javascript functions or are they added to standard XPath functions. Actually, in both cases, you don't have to modify xsltforms.js, is that correct? Best regards, Alain Le 07/04/2016 23:08, Mats Eklund a écrit :Hi Alain, Thought I should share with you the solution I arrived at in the end for the problem how best to implement downloading of instances to disk: <xf:load target=”xsltforms:download” xsltforms:filename="data.xml"> <xf:resource value="create-object-url(serialize(instance('data')),'text/xml')"/></xf:load> Regards,Mats Date: Mon, 21 Sep 2015 09:09:13 +0000 Hi Alain, Somewhat related to my previous question how best leverage HTML 5 Web Workers for async processing in XForms/XsltForms, I now have a similar question, this time related to how best to leverage browsers' capability to allow downloading of resources client-side utilizing the HTML 5 @download attribute on the <a/> element combined with the URL.createObjectURL() method of the File API (http://www.w3.org/TR/FileAPI/#dfn-createObjectURL), and am interested to get your opinion on possible options of extending XsltForms. Obviously it is possible already now to leverage these features in XsltForms via the <xf:load resource="javascript:..."/> or <xf:script/> elements, but I'm thinking this functionality should rather be exposed through and encapsulated in a proper XForms extension element. I was first figuring around the following options: <xf:download ref/value=""/> as a control element, "mirroring" the <xf:upload/> control already part of the XForms specification<xf:download ref/value=""/> as an _action_ element, allowing it to be used in event handlers for the <xf:trigger/> element for example, similar to the <xf:load/> action element. (I'm wondering why the <xf:upload/> wasn't made an action element in XForms as well...?!) At the same time, other options also exist: A custom @appearance attribute on the <xf:output/> element (as in Orbeon Forms: http://wiki.orbeon.com/forms/doc/developer-guide/xforms-controls/output-control?pli=1#TOC-Appearance-xxforms:download)Extended behavior of the <xf:submission resource="file://" method="get/put".../> element... ... What are your thoughts here? Which option would make most sense in your view? Regards,Mats ------------------------------------------------------------------------------ _______________________________________________Xsltforms-support mailing lis...@li...https://lists.sourceforge.net/lists/listinfo/xsltforms-support |
From: Mats E. <mat...@li...> - 2016-04-11 21:47:13
|
Hi Alain, Just for background, many of these enhancements were necessary to make it possible to run XSLTForms as offline forms (compare InfoPath). - Some deeper changes were required to make XSLTForms work in Chrome App context. Google Chrome imposes some unfortunate restrictions on browser apps, including 1) banning synchronous XMLHttpRequests and 2) forbidding inline scripts. To cope with the former, XSLTForms' init functions had to be rewritten as async functions with continuation callbacks, and for the latter, xsltforms.xsl had to be extended with an option to output scripts into separate resource files (I am using an XSLT 2.0 stylesheet that includes xsltforms.xsl), which in turn required some changes to XSLTForms' subform loading scripts for example. Maybe such extensive changes are not required for apps in other browsers, however, Chrome still offers significant advantages (speed, app deployment options, ...) which justified these efforts. File access, as well as local storage access, required extending the submission module to interface with the chrome.fileSystem and chrome.storage.local APIs. - I implemented a separate transform() function in the saxon namespace, however I agree that the solution you propose would be much more elegant. The trickiest thing with including the SaxonCE library was to tweak it such that it loads synchronously as a normal js library! Having access to XSLT 2.0 can be quite useful in offline forms where one cannot call upon a server to do transformations, schematron validation etc.! - True, in Web Worker context there is no access to the page document object. A few deeper changes were required to XSLTForms code to allow fairly arbitrary XPath expressions to be evaluated in Web Worker context. Some of the XPath function implementations in XSLTForms depend on the page document object which is not available in Web Worker context and also not sensible to serialize. I solved it by making sure functions access all their resources via the XPath evaluation context object (which had to be extended with a reference to the XForms model object), and serialized to a proper depth. - For XML schema validation, I am calling the following library: https://github.com/hubgit/xml.js/tree/dtd-validation. I think it works in all browsers! - Both validation functions are currently XPath extension functions (maybe they could be implemented as extension actions instead -- or as emulated web-service operations accessible via the submission element so as to keep things standard?). I use them in my offline forms to validate instance documents opened by the user from the file system, or for validating form entries with an approach similar to this: http://wiki.orbeon.com/forms/how-to/logic/external-validation, not requiring calling an external service. I have them evaluated in a non-blocking background thread using the @async='true' extension. - parse-xml() (which by the way seems to be a standard function in a more recent version of XPath) replaces xf:setnode in the following way: <xf:insert nodeset="instance('data')" origin="parse-xml(transform(...))"/> (for example) - Another often needed improvement I've implemented is the xf:select1/@selection="open" (i.e. combobox). It's a simple change that leverages the HTML 5 @datalist. I will think how to best share these extensions! Whatever makes it easier to potentially have some of these make it into the official version! :) Kind regards,Mats On Sun, 10 Apr 2016 21:45:52 +0200 ala...@ag... wrote: Hi Mats, - Allowing XSLTForms to be run as Chrome Apps, with file save/open functionality etc. Could you please write some documentation about how you succeeded? It might be added in XSLTForms Wikibook, for example.- Embedding SaxonCE library so that transform() function can run XSLT2 transforms Have you modified the transform() function so that it is looking at the version of the stylesheet? Could this better be considered as a global option to be added in config files?- Adding @async attribute to xf:setvalue/xf:insert elements for non-blocking evaluation of long running XPath expressions in Web Workers Web Workers are not available in old browsers but all recent ones do now! I did not try to use them yet (priorities...) and I still wonder how they can access the XML DOM in the main page: is it a problem??- Adding validate-with-xml-schema() function, using xmllint library Is it that Chrome Apps allow you to link C libraries?- Adding validate-with-schematron() function, using SaxonCE. Useful for doing more advanced form validations using SVRL. Is it an XPath function? When are you calling it? Before submission? XForms is based on validation at node level whenever a value has been modified: do you think that it is also compatible with SVRL?- Adding parse-xml() function, believe replacing need for xf:setnode xf:setvalue is there to set a value not to import nodes... That's why I added xf:setnode with the serialized XML string as parameter. In what context do you use parse-xml()? Which document/instance owns the resulting nodes? Would be glad to contribute these as well as some other extensions and performance optimizations. Will be glad to look at them in details!! Is it your intent to publish source files independently or to fork the repository? Thanks! Alain |