I have gone all over the web looking for an answer to this, and have not been able to find one anywhere.
I'm trying to build a web form that uses XSLT
to generate XML
data. I'm basing it on other forms that do the same thing, and have gotten small test structures to work fine. However, I am running into all sorts of problems when I try to map it to repeated elements.
Here's a quick overview of what I have. I have an XSLT
file that looks similar to this (disclaimer: lines excluded for brevity; also, these are NOT the actual field names):
<someForm:Name></someForm:Name>
<someForm:Address></someForm:Address>
<someForm:Plan>
<someForm:Step></someForm:Step>
<someForm:Description></someForm:Description>
</someform:Plan>
I also have an associated schema that looks like this:
<xs:element name="Name" />
<xs:element name="Address" />
<xs:element name="Plan" maxOccurs="10">
<xs:complexType>
<xs:sequence>
<xs:element name="Step" />
<xs:element name="Description" />
</xs:sequence>
</xs:complexType>
</xs:element>
Make note of the "maxOccurs='10'" in the Plan element! This is where I'm having problems!
I wrote a form (again, based on other, working forms) that looks like this:
<input type="text" id="getName" xpath="/*[local-name()='Name']">
<input type="text" id="getAddress" xpath="/*[local-name()='Address']">
<table>
<tr><th>Step</th><th>Description</th></tr>
<tr>
<td><input type="text" id="getStep1" xpath="/*[local-name()='Plan']/*[local-name()='Step']"></td>
<td><input type="text" id="getDesc1" xpath="/*[local-name()='Plan']/*[local-name()='Description']"></td>
</tr>
</table>
This works fine; I am able to submit data, and it creates the XML as I want.
However, here is my problem: I am trying to write my setup so it can accommodate up to ten rows (as per the maxOccurs setting). It will NOT work when I try to do this:
<tr>
<td><input type="text" id="getStep1" xpath="/*[local-name()='Plan']/*[local-name()='Step']"></td>
<td><input type="text" id="getDesc1" xpath="/*[local-name()='Plan']/*[local-name()='Description']"></td>
</tr>
<tr>
<td><input type="text" id="getStep2" xpath="/*[local-name()='Plan']/*[local-name()='Step']"></td>
<td><input type="text" id="getDesc2" xpath="/*[local-name()='Plan']/*[local-name()='Description']"></td>
</tr>
This gives me all sorts of problems, depending on how I tweak it. Sometimes, it does not save any data (for Step and Description); sometimes, it saves the same data for both rows.
I have not been able to find any documentation that explains how this works. I've tweaked the XSLT
, HTML
, and schema
, all to no avail. And this is frustrating the crap out of me.
Does anyone have any insight as to how to solve this?
Note: this is directly related to another question that I asked earlier: Creating XSLT nodes dynamically/multiple XSLT nodes
Thanks in advance for any assistance . . .