I am trying to make a website XML editor and I am using spry datasets and nested datasets to do this. However I have an XML file like this:
<Seating_Plan>
<Department id="A">
<DeptCode>001</DeptCode>
<DeptName>Test1</DeptName>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5<li>
</Department>
<Department id="B">
<DeptCode>002</DeptCode>
<DeptName>Test2</DeptName>
<li>6</li>
<li>7</li>
<li>8</li>
<li>9</li>
<li>10</li>
</Department>
</Seating_Plan>
And I have my HTML like this:
<script type="text/javascript">
var XML = new Spry.Data.XMLDataSet("../XML/XML.xml", "Seating_Plan/Person");
var XML_Dept = new Spry.Data.XMLDataSet("../XML/XML.xml", "Seating_Plan/Department");
var dslists = new Spry.Data.NestedXMLDataSet("../XML/XML.xml", "li");
</script>
<div spry:region="XML_Dept">
<table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr class="XML_Container_Header">
<th height="40">ID</th>
<th>DeptCode</th>
<th>DeptName</th>
<th>Description</th>
<th>lists</th>
</tr>
<tr spry:repeat="XML_Dept">
<td><input id="ID_Dept" name="ID_Dept" type="text" class="textfields" value="{@id}" size="3" maxlength="3"></td>
<td><input id="ID_Dept" name="ID_Dept" type="text" class="textfields" value="{DeptCode}" size="30" maxlength="30"></td>
<td><input id="ID_Dept" name="ID_Dept" type="text" class="textfields" value="{DeptName}" size="50" maxlength="50"></td>
<td><input id="ID_Dept" name="ID_Dept" type="text" class="textfields" value="{li}" size="50" maxlength="50"></td>
<td spry:region="XML_Dept"><ul spry:repeatchildren="dslists"><li><input id="ID_Dept" name="ID_Dept" type="text" class="textfields" value="{li}" size="50" maxlength="50"></li></ul></td>
</tr>
</table>
The first row is displayed correctly with the XML LI elements of Department "A", however the second row or Department B in the table has duplicated the Department "A" XML Li Elements, How do I get it to display the department B li elements removing the duplication...?
In other words:
Any ideas would be gratefully appreciated!!
Many thanks!
No comments:
Post a Comment