[Xsltforms-support] subforms and PI mechanism of profiler (was Re: getting your feet wet with the p
Brought to you by:
alain-couthures
|
From: C. M. Sperberg-M. <cm...@bl...> - 2011-12-09 22:53:21
|
On Dec 9, 2011, at 2:09 PM, Alain Couthures wrote:
> ...
>
> In the latest builds, the Profiler is even a form: this means that it can be customized by authors themselves. The profiling data is collected as an XML document and a specific processing-instruction tells XSLTForms which form to associate with.
I shall have to study this.
> I plan to add more information in the Profiler instance (instances copies, the calling form source, ...): the Profiler will progressively become a real XForms Debugger written in XForms.
>
> About your form performance, I already suspected that counting preceding siblings would cost a lot of time: Javascript doesn't like loops (XSLTForms has to have its own XPath machine written in Javascript... I proposed a paper for XML Prague 2012 about how to write an XQuery compiler into Javascript instructions). I recently added support for the id() function and it's even much better for performance.
Does id() require that the instance be an external instance, so it can have a DTD?
Or how does the id() function identify ID attributes?
> Defining a subform is now another possibility to simplify a form. This is not yet documented but I already love it much. Don't hesitate to ask me about subforms if you're interested in.
>
> If you want to load another form in a new browser tab from an instance without server exchanges, defining an extra parameter for the load action should be simple with the processing-instruction capability I already use for the Profiler (this processing-instruction mechanism is very promising indeed, I'm currently building a small XRAP (XForms-REST-Apache-PHP) application with minimal generic PHP scripts, XML files and folders on server).
>
> XML allows us to consider programs as data. We might not be numerous to envision this (but the community is strong) and I have to confess that I'm still marveled by this.
Subforms or a new browser tab may be exactly what I'm now looking for.
The profiler made me realize that my case switch to allow the user to edit the
PL/0 assembler code was exacting a high cost in number of additional nodes,
which in turn was making refreshes more expensive. So I'd like to move
the editing function to a different form, and make the 'Edit code' button (on
the simulator page) link to / load / transfer to the code editor. The code
editor should similarly have a 'Run code' button to go (back) to the simulator.
Since I don't want to allow arbitrary Web users to store arbitrary data on my
server, I don't want to save the 'code' instance on the server and then load
that XML document in the other form -- I'd like to hand the user's XML instance
back and forth from one form to another. Initially, I thought I could manage
this with a simple shell script: the 'Edit code' button submits the 'code' instance
to that shell script, and the shell script sends back a concatenation of four things:
1 an HTTP header with "Content-Type: application/xhtml+xml" and a blank line
2 the first few lines of an XHTML document, from <?xml-stylesheet ...
to <xf:instance id="code">
3 the code document submitted by the user (without the XML declaration)
4 the remainder of the XHTML document, from </xf:instance> to </html>
As far as I can tell, the script is working as I expected, but the browser is not
loading the new form in the way I had expected; instead I get a series of error
messages of the form "Unsupported mediatype '... [ entire body of the
inline document instance] ...' for instance #code", one for each inline instance,
and then one for #xf-instance-config.
I have probably failed to understand the true meaning of the submission process.
(Or rather: I have certainly never bothered to read up on all the details. XForms
has worked intuitively enough for me that I haven't had to, yet.)
So perhaps subforms and/or the additional load parameter are just what I'm
looking for. (In this case, my immediate goal is to avoid incurring the cost of
building all the editing widgets for the code instance until the user actually asks
to edit it. If that can be done without server hits, that would be idea. But if there
is a way to realize my original idea of passing a user instance from one
form to another by bouncing it off the server (like a soccer player passing the
ball to a teammate before running past a defender, and then getting the ball
right back from the teammate), it would be nice to know how to do that, too.
Thank you very much for your work on XSLTForms!
Michael
--
****************************************************************
* C. M. Sperberg-McQueen, Black Mesa Technologies LLC
* http://www.blackmesatech.com
* http://cmsmcq.com/mib
* http://balisage.net
****************************************************************
|