View Single Post
  #1 (permalink)  
Old March 4th, 2008, 09:57 AM
li72 li72 is offline
Authorized User
 
Join Date: May 2007
Location: , , .
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default help on xslt transformation

Assuming we have an xml document like the one below.
<data>
   <node1 label="label1" type="integer" />
   <node2 label="label2" type="date" />
   <node3 label="label2" type="string" />
   </data>
 we need to transform this doc into XForms doc.
The model part looks like this
<model>
………………………………………… ………………….
………………………………………… ………………….
<xforms:bind nodeset="node1" required="true()" type="xs:integer"/>
<xforms:bind nodeset="node2" required="true()" type="xs:date"/>
<xforms:bind nodeset="node3" required="false()" type="xs:string"/>
</model>

for each node in xml document xslt processor should generates an XForms control element <xforms:input ……….> with link to the corresponding bind node. The label of each XForms control should take its value from the attribute [label].
The expected result it should like this

<p>
<xforms:input ref="node1">
<xforms:label> label1 </xforms:label>
</xforms:input> </p>
<p>
<xforms:input ref="node2">
<xforms:label> label2 </xforms:label>
</xforms:input> </p>
<p>
<xforms:input ref="node3">
<xforms:label> label3 </xforms:label>
</xforms:input> </p>

The question is how to write a template that generates this part of XForms dynamically?


Any help is much appreciated


Reply With Quote