[Xsltforms-support] xsltforms and MarkLogic submission
Brought to you by:
alain-couthures
From: <mcu...@co...> - 2011-08-31 19:27:46
|
I am attempting to use MarkLogic and xsltforms to load data from an xml file (stored in a MarkLogic database) into the form, edit the data in the form, and then save the edited xml file back to the MarkLogic database. I have created the database and the HTTP server. The form correctly reads the data from the database file ('/test/data.xml') and loads it into the form in the browser. The part that does not work is saving the edited file back to the MarkLogic database (<xf:submission method="put"/>). Can someone explain to me how to enable the submission? Does it depend on webdav? What are the setup steps? The xquery is below. Thanks, Morgan Cundiff ---------------------------- xquery version "1.0-ml"; declare namespace xdmp=" http://marklogic.com/xdmp "; let $page := (xdmp:set-response-content-type("application/xml"), <html xmlns=" http://www.w3.org/1999/xhtml " xmlns:xf=" http://www.w3.org/2002/xforms " xmlns:xs=" http://www.w3.org/2001/XMLSchema " xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance "> <head> <title>Submission with get and put</title> <xf:model> <xf:instance id="data-instance" src="/test/data.xml" xmlns="" /> <xf:submission id="read-from-file" method="get" action="/test/data.xml" replace="instance" instance="data-instance" /> <xf:submission id="save-to-file" method="put" action="/test/data.xml" replace="instance" instance="data-instance" /> </xf:model> </head> <body> <p>Demonstration of using XForms to get and put data to ML database using the submission element.</p> <xf:input ref="Element1"> <xf:label>Element 1:</xf:label> </xf:input> <br /> <xf:input ref="Element2"> <xf:label>Element 2:</xf:label> </xf:input> <br /> <xf:input ref="Element3"> <xf:label>Element 3:</xf:label> <br /> </xf:input> <xf:submit submission="read-from-file"> <xf:label>Reload</xf:label> </xf:submit> <xf:submit submission="save-to-file"> <xf:label>Save</xf:label> </xf:submit> </body> </html>) let $xslt-pi := processing-instruction xml-stylesheet {'type="text/xsl" href="xsltforms/xsltforms.xsl"'} return ($xslt-pi, $page) ------------------------------------- |