difference in xform data

21 views
Skip to first unread message

Subramaniyam KMV

unread,
Sep 15, 2014, 3:40:58 AM9/15/14
to openxd...@googlegroups.com
Hello,

I have created a form with TWO Pages. The Original xform which is stored in mysql Database is give below

Xform Original (From Database)

<?xml version="1.0" encoding="UTF-8"?> <xforms xmlns="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema">   
<model>     
<instance id="dc_emp_v1">       
<dc_emp_v1 name="emp_v1" id="24" formKey="dc_emp_v1">         
<question1/>         
<question2/>         
<question3/>         
<question4/>       
</dc_emp_v1>     
</instance>     
<bind id="question1" nodeset="/dc_emp_v1/question1" type="xsd:string"/>     
<bind id="question2" nodeset="/dc_emp_v1/question2" type="xsd:string"/>     
<bind id="question3" nodeset="/dc_emp_v1/question3" type="xsd:string"/>     
<bind id="question4" nodeset="/dc_emp_v1/question4" type="xsd:string"/>   
</model>   
<group id="1">     
<label>Page1</label>     
<input bind="question1">       
<label>Question1</label>     
</input>     
<input bind="question2">       
<label>Question2</label>     
</input>     
<input bind="question3">       
<label>Question3</label>     
</input>   
</group>   
<group id="2">     
<label>Page2</label>     
<input bind="question4">       
<label>Question4</label>     
</input>   
</group> 
</xforms>


When i download the form from ODK collect


Final xml data is looks like 

<?xml version="1.0" encoding="UTF-8"?><h:html xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xf="http://www.w3.org/2002/xforms" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:h="http://www.w3.org/1999/xhtml" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:jr="http://openrosa.org/javarosa" xmlns="http://www.w3.org/2002/xforms">
<h:head>
<h:title>emp_v1</h:title>
<model>
<instance>
<dc_emp_v1 name="emp_v1" id="24" formKey="dc_emp_v1">
<question1/>
<question2/>
<question3/>
<question4/>
</dc_emp_v1>
</instance>
<bind id="question1" nodeset="/dc_emp_v1/question1" type="xsd:string"/>
<bind id="question2" nodeset="/dc_emp_v1/question2" type="xsd:string"/>
<bind id="question3" nodeset="/dc_emp_v1/question3" type="xsd:string"/>
<bind id="question4" nodeset="/dc_emp_v1/question4" type="xsd:string"/>
</model>
</h:head>
<h:body>
<label>Page1</label>
<input bind="question1">
<label>Question1</label>
</input>
<input bind="question2">
<label>Question2</label>
</input>
<input bind="question3">
<label>Question3</label>
</input>
</h:body>
</h:html>

Why the group element is missing in the above generated file ??

Can anyone tell me the reason.

Thanks
Subramaniyam.KMV 




 

Raghu Mittal

unread,
Sep 15, 2014, 8:36:47 AM9/15/14
to openxd...@googlegroups.com
Hi Subramaniyam,

This removal of group element is by design. The reason is that OXD forms has the concept of pages, but ODK works on showing one question per page, so this grouping is generally not needed. That's why it is removed during the conversion process. 

If you need to put groups in ODK, please refer to my email where I pointed out what you should do in your OXDforms xml to get a group in ODK.

Regards,
Raghu



--
You received this message because you are subscribed to the Google Groups "openXdata Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openxdata-de...@googlegroups.com.
To post to this group, send email to openxd...@googlegroups.com.
Visit this group at http://groups.google.com/group/openxdata-dev.
For more options, visit https://groups.google.com/d/optout.

Subramaniyam KMV

unread,
Sep 18, 2014, 12:03:28 AM9/18/14
to openxd...@googlegroups.com
Hi Raghu,

Finally we have found out the solution. We have done the following.

1) oxd2odk.xsl --> modified the statement <xsl:apply-templates select="*[local-name() = 'group']"/> 

This will fetch all the group items which is saved in the database.

2) added the following code

<xsl:template match="//*[local-name()='group']/@id">
<xsl:attribute name="appearance">
<xsl:text>field-list</xsl:text>
</xsl:attribute>
</xsl:template>

This will replace the group id = to group appearance = "field-list"

Regards,
Subramaniyam.KMV

Raghu Mittal

unread,
Sep 18, 2014, 9:01:17 AM9/18/14
to openxd...@googlegroups.com
I thought that you want ODK grouping for questions once in a while, but I realize from your code that you want question grouping same as you designed in OXD. Well, if this works for you, then great. Just a word of caution - I am not really sure, but some questions may not work as expected on ODK when put in a field-list. Please test Picture type, GPS and other special questions to confirm that they work correctly in a field-list.

Regards,
Raghu

Subramaniyam KMV

unread,
Sep 19, 2014, 8:32:22 AM9/19/14
to openxd...@googlegroups.com
Hi Raghu,

We have tested Picture,GPS with Multiple Pages. It worked fine.

Thanks & Regards,
Subramaniyam.KMV

Raghu Mittal

unread,
Sep 19, 2014, 10:08:19 AM9/19/14
to openxd...@googlegroups.com
Ok. That's great then.

Regards,
Raghu

Dagmar Timler

unread,
Sep 19, 2014, 10:18:21 AM9/19/14
to openXdata Developers
Thanks for the update and for sharing your code changes.
Reply all
Reply to author
Forward
0 new messages