Re: [Xsltforms-support] stepping through recordset type data display
Brought to you by:
alain-couthures
From: Klotz, L. <Lei...@XE...> - 2010-01-05 23:30:21
|
If the test code is working for you, it's possible there's a bug with bind in XSLTForms so you might try re-doing your existing code without the bind/@id and see if that works. By the way, there are a couple of simplications you might try as well: . Unless I'm wrong and XSLTForms is unusual, you can remove a couple of MIP attribute from those binds: <xf:bind id="selected_deployment_fid" nodeset="instance('inst_selected')/deployment_fid" type="xsd:string" required="false()" /> The type and required bindings aren't doing anything for you. You might be planning to use them for something later though. If you do decide to put the types in, you'll probably need an xmlns:xsd definition, or else use a recent SVN release of XSLTforms and use unprefixed names (which are actually defined as unions with the empty string). . In XPath, // is usually expensive: In ref="instance('inst_selected')//installation_fid" You might do get better performnance if the binding doesn't have to search the entire instance to find the element. In this case, since the context node default is "/*[1]" you can just do ref="instance('inst_selected')/installation_fid" . xforms-ready vs. xforms-model-construct-done Unless you want to wait for the UI to be initialized, you can do model setup on xforms-model-construct-done instead of on xforms-ready. It should avoid an extra (possibly expensive) refresh. . Initial instances This may be an artifact of your test code that the instances are loaded from long query stirngs, but you might find it more maintainable to do this: (You might not find this more readable, but if you do, it might be helpful.) <xf:instance id="inst_installations"> <data xmlns=""> <service>WFS</service> <version>1.1.0<version> <request>GetFeature</request> <namespace>xmlns(aatams=http://www.imos.org.au/aatams)</namespace> <typename>aatams:installation</typename> </data> </xf:instance> <xf:submission id="init_inst_installations" resource="../deegree-wfs/services" ref="instance('inst_installations')" replace="instance" method="get" separator="&" /> <xf:send ev:event="xforms-model-construct-done" submission="init_inst_installations" /> . Questions about the init sequence Why is the dispatch of the custom event "set-selected" and separate setvalue necessary? Does doing the setvalue directly on xforms-ready (or on xforms-model-construct-done) not work? If it doesn't, it may be an XSLTForms bug. Also, the dispatche to xforms-revalidate is a puzzler as well, and if it's a bug workaround for xsltforms it would be good to know. I'd have naively thought that this might work fine: <xf:setvalue ev:event="xforms-model-construct-done" ref="instance('inst_selected')/installation_fid" value="instance('inst_installations')/aatams:installation[1]/@gml:id" /> . @incremental @incremental isn't an xpath expression, so it's incremental="true". Leigh. -----Original Message----- From: Stephen Cameron [mailto:Ste...@ut...] Sent: Monday, January 04, 2010 9:32 PM To: xsl...@li... Subject: [Xsltforms-support] stepping through recordset type data display 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 ------------------------------------------------------------------------------ This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers http://p.sf.net/sfu/verizon-dev2dev _______________________________________________ Xsltforms-support mailing list Xsl...@li... https://lists.sourceforge.net/lists/listinfo/xsltforms-support |