[Xsltforms-support] stepping through recordset type data display
Brought to you by:
alain-couthures
|
From: Stephen C. <Ste...@ut...> - 2010-01-05 05:32:15
|
Hello, I have a specific problem where I wish to select a record from a xf:select1 list and then on on the basis of the selected value display a full record below it. The full record will be displayed with the use of a xf:group tag, so I am a really wanting to dynamically change the node the group references via its 'ref 'or 'bind' attribute. I cannot get this to work, but I cannot find an example where someone has done this to know that it should work. Effectively the behaviour that I want to replicate can be seen in an (non-Xform) example here http://xmljs.sourceforge.net/contributedAdd-ons/xpath/sampleApplications/contactManager/contactManager.html. This just steps through a xml 'recordset' displaying each record in turn. I'd be interested to see this done in an XSLTForms example! My Xform code is as follows: <?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet href="forms/xsltforms/xsltforms.xsl" type="text/xsl"?> <html xmlns:gml="http://www.opengis.net/gml" xmlns:wfs="http://www.opengis.net/wfs" xmlns:aatams="http://www.imos.org.au/aatams" xmlns="http://www.w3.org/1999/xhtml" xmlns:xf="http://www.w3.org/2002/xforms" xmlns:ev="http://www.w3.org/2001/xml-events" wfs:dummy="dummy" gml:dummy="dummy" aatams:dummy="dummy"> <head> <title>PRINT RECOVERY WORKSHEET</title> <link href="forms/aatams.css" rel="stylesheet" type="text/css" /> <xf:model id="model1"> <!-- get the relevant deployments --> <xf:instance id="inst_installations" src="../deegree-wfs/services?service=WFS&version=1.1.0&request=GetFeature&namespace=xmlns(aatams=http://www.imos.org.au/aatams)&typename=aatams:installation" /> <xf:instance id="inst_installation_deployments" src="../deegree-wfs/services?service=WFS&version=1.1.0&request=GetFeature&namespace=xmlns(aatams=http://www.imos.org.au/aatams)&typename=aatams:installation_deployment" /> <xf:instance id="inst_selected"> <data> <installation_fid /> <deployment_fid /> </data> </xf:instance> <xf:bind id="selected_installation_fid" nodeset="instance('inst_selected')/installation_fid" type="xsd:string" required="false()" /> <xf:bind id="selected_deployment_fid" nodeset="instance('inst_selected')/deployment_fid" type="xsd:string" required="false()" /> <xf:bind id="selected_deployment" nodeset="instance('inst_installation_deployments')//aatams:installation_deployment[aatams:deployment_fid=instance('inst_selected')/deployment_fid]" /> <xf:dispatch ev:event="xforms-ready" name="set-selected" target="model1" /> <xf:action ev:event="set-selected"> <xf:setvalue ref="instance('inst_selected')//installation_fid" value="instance('inst_installations')//aatams:installation[1]/@gml:id" /> <xf:dispatch name="xforms-revalidate" target="model1" /> </xf:action> </xf:model> </head> <body> <xf:switch> <xf:case id="select_deployment"> <div class="form"> <legend>PRINT RECOVERY WORKSHEET</legend> <div class="form-contents"> <div class="dependant-selects"> <xf:select1 bind="selected_installation_fid" appearance="minimal" incremental="true()"> <xf:label>Installation</xf:label> <xf:itemset nodeset="instance('inst_installations')//aatams:installation"> <xf:value ref="@gml:id" /> <xf:label ref="aatams:name" /> </xf:itemset> <xf:action ev:event="xforms-value-changed"> <xf:setvalue ref="instance('inst_selected')//deployment_fid" value="" /> </xf:action> </xf:select1> <xf:select1 bind="selected_deployment_fid" appearance="minimal" incremental="true()"> <xf:label>Scheduled Recoveries</xf:label> <xf:itemset nodeset="instance('inst_installation_deployments')//aatams:installation_deployment[aatams:installation_fid=instance('inst_selected')/installation_fid and aatams:scheduled_recovery_date >= local-date()]"> <xf:value ref="@gml:id" /> <xf:label ref="aatams:name" /> </xf:itemset> </xf:select1> </div> <xf:trigger> <xf:label>Show Worksheet</xf:label> <xf:toggle case="show_worksheet" ev:event="DOMActivate" /> </xf:trigger> </div> </div> </xf:case> <xf:case id="show_worksheet"> <xf:group bind="selected_deployment"> <xf:output ref="aatams:longitude"> <xf:label>Longitude:</xf:label> </xf:output> <xf:output ref="aatams:latitude"> <xf:label>Latitude:</xf:label> </xf:output> </xf:group> <xf:output bind="selected_deployment_fid"> <xf:label>deployment:</xf:label> </xf:output> <xf:trigger> <xf:label>Select Deployment</xf:label> <xf:toggle case="select_deployment" ev:event="DOMActivate" /> </xf:trigger> </xf:case> </xf:switch> <br /> <div id="console" style="display:block;top:100px;" /> </body> </html> I want the output controls in the xf:group to change according to the item selected in the second select. Interestingly the contents of the second xf:select1 changes automatically according to what is selected by the user in the first xf:select1 but the 'context' of the xf:group is not changing in the same fashion. I can provide all the model data files as well if anyone is interested to see this in action. -- Regards Stephen Cameron Data Programmer Integrated Marine Observing System (IMOS) eMarine Information Infrastructure Project University of Tasmania, Private Bag 21, Hobart, TAS 7001, Australia Tel: +61 3 6226 8507 Fax: +61 3 6226 2997 Email: ste...@ut... URL: http://www.imos.org.au/eMII.html |