Hi.
I would like to pass xml DOM document created in CForm to xquery. Is it
possible to access document nodes from xquery ?
My CForm generates simple xml document :
<project>
<id>1</id>
<title>t</title>
<description>d</description>
<pdfLink>p</pdfLink>
</project>
In flowscript I passed the document object to sitemap :
function editproject()
{
var form = new
Form("cocoon://resource/internal/forms/project_model.xml");
var bindUri = cocoon.parameters.bindingURI;
form.createBinding(bindUri);
var docUri = cocoon.parameters.documentURI;
var document = loadDocument(docUri);
form.load(document);
form.showForm("editproject-display-pipeline");
form.save(document);
cocoon.sendPage("update31", {"doc" : document});
}
In sitemap I passed document to XqueryGenerator :
<map:pipeline>
<map:match pattern="update31">
<map:generate src="xupdate.xq" type="xquery">
<map:parameter name="doc" value="{flow-attribute:doc}"/>
</map:generate>
<map:serialize type="html"/>
</map:match>
</map:pipeline>
And then I tried to access document structure in xquery :
xquery version "1.0";
declare namespace request="http://exist-db.org/xquery/request";
declare variable $doc external;
update insert
<project>
<id>{$doc/id}</id>
<title>{$doc/title}</title>
<description>{$doc/description}</description>
<pdfLink>{$doc/pdfLink}</pdfLink>
</project>
into doc("/db/tomek/projects/projects.xml")/projects
Unfortunately I recived XMLDBException that I can`t use xs:string(1 t d p)
as node collection.
Any ideas would be appreciated.
Regards,
Tomek Piechowicz