You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Thomas Nichols <nx...@yahoo.co.uk> on 2004/08/25 18:42:35 UTC

XForms / JXForms / CForms - itemset with copy?

Hi,

I'm looking for a way to allow user selection of an XML fragment (with a 
couple of fragments to choose between), with this fragment then being 
incorporated into the returned output document. At its simplest, this is 
a selection widget of some kind, depending on the selection I'll see one 
of two XML fragments appearing as output. Those fragments are themselves 
defined within the instance data for the form.

With XForms, this could be handled with
<xf:select1 .....>
  ...
  <xf:itemset .../>
    <xf:copy ..../>
</xf:select1>
which will select a node from the itemset (including all descendant 
children, attributes etc.) and copy it into the output instance. The 
JXForms page suggests itemset supports use of 'value', but not of 'copy' 
- is that right? Unfortunately 'value' gives me a flattened - 
simpleContent - output, I need the complexContent that 'copy' provides.

So - is there any way to achieve this using CForms? The best I've come 
up with so far is to escape the fragments to produce simpleContent 
strings, so that
<a><b/></a>
becomes
&lt;a&gt;&lt;b/&gt;&lt;/a&gt;
Clearly this has to happen at the point the fragments are presented to 
the user, but I was hoping to avoid escaping until this point and keep 
with usable XML that could travel through pipelines for the rest of the 
process - in particular, keeping the instance data clean.

Any suggestions?

Thanks,
Thomas.

PS: If you can't see how this could work in CForms/JXForms, what would 
you use to escape the XML? Use the Java StringEscapeUtils - 
http://wiki.apache.org/cocoon/XMLProcessingHowTo  - or code it in XSLT?


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org