> On Feb 10, 2017, at 3:01 AM, Conal Tuohy <[email protected]> wrote:
> ...
> 
> So It seems to me, in order to send my XML as a form parameter, I need to 
> serialize the XML first, and then submit the serialization. I was hoping that 
> XForms would provide a custom "serialize()" function that would escape my XML 
> as text, or that there'd be some other obvious way to fix this, but I haven't 
> found anything.

What version of XSLTForms are you using? 

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.)

The transform() function also produces a string (with the serialized form
of the XML in question), so the expression 
transform(instance(‘thisone’),’identity.xsl’,false)
should produce the string you want.  

> 
> The only solution I can see is to use a recursive <xf:action> to walk my XML 
> instance's tree, gradually serializing it into a text node in another 
> instance, and then submit THAT instance. This seems awkward, but I'm sure 
> it's possible, and I'll do it if no-one can suggest anything better!

Ooof!  Well, that would work, I guess.  But try serialize() and transform() 
first.  
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.

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?

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.)

********************************************
C. M. Sperberg-McQueen
Black Mesa Technologies LLC
[email protected]
http://www.blackmesatech.com
********************************************


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Xsltforms-support mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xsltforms-support

Reply via email to