Is anyone using XSLTForms and passing data from the form to a XQuery module?
If so, what are the XLSTForms structures that you use to accomplish this task? From: [email protected] [mailto:[email protected]] On Behalf Of Steiner, David J. (LNG-DAY) Sent: Wednesday, June 09, 2010 4:30 PM To: [email protected] Subject: [MarkLogic Dev General] using input from XForm "input" in xquery Ok, I'm not well versed in HTML, Javascript, CSS, etc., so I thought I'd try XForms. I am not getting how to use the "input" I get from a user and "pass" that string of text to an XQuery, then use the result of an XQuery as the "output" in the XForm. Scenario: User enters a string of text. User clicks button [clicking button passes string to xquery function that returns modified string of text] User sees the modified string of text. I have looked at many of the basic examples for XForms but I'm just not seeing how to incorporate XQuery the way I'd like to... Here's essentially what I want to do [with the "problem" highlighted in yellow]: xquery version "1.0-ml"; import module namespace nrmq = "/norm" at "/norm/normalizeQuery.xqy"; xdmp:set-response-content-type("application/xml"), <?xml-stylesheet href="xsltforms/xsltforms.xsl" type="text/xsl"?>, <?xsltforms-options debug="yes"?>, <html xmlns="http://www.w3.org/1999/xhtml" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xf="http://www.w3.org/2002/xforms"> <head> <title>The Title</title> <xf:model> <xf:instance> <data xmlns=""> <QueryField/> <NormalizedQuery/> </data> </xf:instance> </xf:model> </head> <body> <p>Type in your query </p> <xf:input ref="QueryField" incremental="true"> <xf:label>Your query: </xf:label> </xf:input> <p/> <xf:output value="QueryField"> <xf:label>As you typed it in: </xf:label> </xf:output> <p/> <xf:trigger> <xf:label>Normalize</xf:label> <xf:hint>Hit this button when you're satisfied you've entered your query correctly.</xf:hint> <xf:action ev:event="DOMActivate"> <xf:setvalue ref="/data/NormalizedQuery"> {nrmq:normalizeQuery(/data/QueryField)} </xf:setvalue> </xf:action> </xf:trigger> <p/> <xf:output ref="NormalizedQuery"> <xf:label>After it has been normalized: </xf:label> </xf:output> </body> </html>
_______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
