[Xsltforms-support] using calculated value in select1 itemset
Brought to you by:
alain-couthures
From: Stephen C. <Ste...@ut...> - 2009-08-11 11:03:02
|
Hello, I would like to calculate the labels appearing in select1, this might be possible using the xf:bind 'calculate' attribute. However whilst the following example works, it only works if the caculated 'new_value' nodes are pre-existing in the instance. My problem is that if the source of the data is an external source then the calculated nodes cannot be inserted prior to the calculation and so perhaps they should be created automatically? Is there another way to handle this situation? <html xmlns="http://www.w3.org/1999/xhtml" xmlns:xf="http://www.w3.org/2002/xforms" xmlns:sample="http://www.agencexml.com/sample" > <head> <title>Demonstration of XForms Select1</title> <style type="text/css">body {font-family: Helvetica, sans-serif;}</style> <xf:model> <xf:instance> <sample:data> <sample:DayOfWeekCode/> </sample:data> </xf:instance> <xf:instance id="days"> <data xmlns=""> <item> <label>Monday</label> <value>mon</value> <new_value/> </item> <item> <label>Tuesday</label> <value>tue</value> <new_value/> </item> </data> </xf:instance> <xf:bind nodeset="instance('days')/item/new_value" calculate="translate(../value,'mtwfs','MTWFS')"/> </xf:model> </head> <body> <xf:select1 ref="sample:DayOfWeekCode" appearance="minimal" incremental="true"> <xf:label>Day of Week:</xf:label> <xf:itemset nodeset="instance('days')/item"> <xf:value ref="new_value"/> <xf:label ref="label"/> </xf:itemset> </xf:select1> <br/> Output: <xf:output ref="sample:DayOfWeekCode"/> </body> </html> -- 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 |