Re: [Xsltforms-support] file uploads
Brought to you by:
alain-couthures
From: Conal T. <con...@gm...> - 2017-02-11 04:26:52
|
BTW if anyone's in a particular hurry for a version of XSLTForms that does "form-data-post" submissions, try https://github.com/Conal-Tuohy/Muscovy/tree/master/xsltforms On 11 February 2017 at 14:12, Conal Tuohy <con...@gm...> wrote: > > > On 11 February 2017 at 00:46, C. M. Sperberg-McQueen < > cm...@bl...> wrote: > >> >> What version of XSLTForms are you using? >> > > I am using XSLTForms rev.639 ... my fork of https://github.com/ > AlainCouthures/xsltforms > > The current draft of XForms 2.0 does define a serialize() function, and >> the snapshot of XSLTForms I downloaded last month from SourceForge >> does have an implementation of it. (Hmm. For that matter, so does >> 1.0RC2 — at least, the array XsltForms_xpathCoreFunctions defined >> in xsltforms.js has an entry for serialize.) >> > > Argh! How did I miss that? Thanks for the tip! I had been thinking > XSLTForms was XForms 1.1, and working from the XForms 1.1 spec, though I > did see the table of functions and simply missed serialize() even though it > was exactly what I was looking for! D'oh! > > I've used serialize() and it's perfect. > > You may need to serialize into another instance using xf:setvalue, just >> because >> > XForms isn’t always ready to accept values instead of references to values. >> > > This is exactly what I've done. I should be away laughing, now, I think. > >> >> And on another note — if you have just spent time figuring out how >> xf:upload >> works out of the box in XSLTForms, and how to modify XSLTForms to make it >> do what you actually needed, could you be persuaded to add a page to the >> XSLTForms wikibook describing what you learned? >> > > Yes I will ... first I will need to contribute the xsltforms changes back > to Alain somehow. I have (unwittingly) forked the wrong repository, it > seems, and because I couldn't get the build process going I simply edited > the xsltforms.js file directly, so I have a bit of work to do first. It's > still not a complete implementation of "form-data-post" since it only works > with instance elements whose type is "xsd:anyURI" and not the binary > content types. But still, it's enough I think. > > Alain, is it best for you if I fork https://github.com/ > AlainCouthures/xphoneforms repository, and make a pull request? > > Once I've contributed the patch to xsltforms.js, I will get onto wikibook > and document the process of using <xf:upload> to upload a binary file, and > the trick of using serialize() to upload XML instances as > multipart/form-data parameters. > > If every time a serious user of XSLTForms had trouble making something >> work, we made it a practice to write up what we learned and put it into >> the >> XSLTForms wikibook, to help the next user, the wikibook would soon be >> much more useful than it has been. (Even in a purely self-interested way, >> this can pay off. Every time I come back to using transform() after a >> long >> period of not thinking about it, I find myself trying to remember how it >> works, >> and so the time I spent writing a page on it in the wikibook a couple of >> years ago has now been paid back two or three times.) >> > > I know! I have only just got back to using XForms after a break of about 4 > years, so I've been consulting it a lot; it's been a very useful resource. > > Conal > > > > -- > Conal Tuohy > http://conaltuohy.com/ > @conal_tuohy > +61-466-324297 <0466%20324%20297> > -- Conal Tuohy http://conaltuohy.com/ @conal_tuohy +61-466-324297 |