I'm pretty beginner in Cocoon, I used the blocks sample of binding XML of
Cocoon, and the usefull part of sitemap is :
<map:match pattern="form2xml.flow">
<map:call function="handleForm">
<map:parameter name="function" value="form2xml"/>
<map:parameter name="definitionURI" value="forms/form2_model.xml"/>
<map:parameter name="documentURI" value="forms/form2_data.xml"/>
<map:parameter name="bindingURI" value="forms/form2_bind_xml.xml"/>
</map:call>
</map:match>
<map:match pattern="*-display-pipeline">
<map:generate src="forms/{1}_template.xml"/>
<map:transform type="forms" label="content1"/>
I think Chris actually meant the other way around: that you need to use
the JX generator rather than the FormsTransformer. Unfortunately over
time the two have gotten out of sync; new features have been added to
the JX macros but not to the transformer. It seems the consensus is
that it's always preferable to use the generator rather than the
transformer, unless your pipeline structure has uncacheable
transformations beforehand, in which case the transformer has better
performance.
Anyway, change the above two lines to just:
<map:generate type="jx" src="forms/{1}_template.xml" />
and you should be good.
<map:transform type="i18n">
<!--map:parameter name="locale" value="en-US"/-->
</map:transform>
<map:call resource="simple-page2html">
<map:parameter name="file" value="forms/{1}_template.xml"/>
</map:call>
<map:transform src="resources/forms-samples-styling.xsl">
<map:parameter name="resources-uri"
value="{request:contextPath}/_cocoon/resources"/>
</map:transform>
<map:transform type="i18n">
</map:transform>
<map:serialize/>
</map:match>
/* part of binding_example.js */
function form2xml(form) {
// get the documentURI parameter from the sitemap which contains the
// location of the file to be edited
var documentURI = cocoon.parameters["documentURI"];
// parse the document to a DOM-tree
var document = loadDocument(documentURI);
// bind the document data to the form
form.load(document);
// show the form to the user until it is validated successfully
form.showForm("form2-display-pipeline");
// bind the form's data back to the document
form.save(document);
// save the DOM-tree back to an XML file, the makeTargetURI
// function makes a modified filename so that the
// original document is not overwritten
saveDocument(document, makeTargetURI(documentURI));
cocoon.sendPage("form2-success-pipeline");
}
I launch the page form2xml.flow and if I did well understand, it calls the
form2xml function, who shows the "form2-display-pipeline" page. In the
sitemap, the map matchs it, and generates from the "forms/{1}_template.xml"
(with my repeaterLoop), pass so through some transformers (which applies
template "translating" the CForms into "Classic Forms", and serializes it.
I don't know where is the problem with the forms transformer.
Thanks in advance
Regards,
Nicolas Duroc
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]