これは私の入力xmlファイルです
<Collection>
<Teach>
<DeptNo>5613</DeptNo>
<DeptName>Computers</DeptName>
<SubjectNo>234</SubjectNo>
<SubjectName>XML</SubjectName>
<Teacher>Sai</Teacher>
</Teach>
<Teach>
<DeptNo>5617</DeptNo>
<DeptName>Electronics</DeptName>
<SubjectNo>789</SubjectNo>
<SubjectName>Circuits</SubjectName>
<Teacher>Hari</Teacher>
</Teach>
<Teach>
<DeptNo>5613</DeptNo>
<DeptName>Computers</DeptName>
<SubjectNo>239</SubjectNo>
<SubjectName>XSLT</SubjectName>
<Teacher>Suri</Teacher>
</Teach>
<Teach>
<DeptNo>5689</DeptNo>
<DeptName>Maths</DeptName>
<SubjectNo>749</SubjectNo>
<SubjectName>Trigonometry</SubjectName>
<Teacher>Arya</Teacher>
</Teach>
<Teach>
<DeptNo>5617</DeptNo>
<DeptName>Electronics</DeptName>
<SubjectNo>789</SubjectNo>
<SubjectName>Circuits</SubjectName>
<Teacher>Bharat</Teacher>
</Teach>
</Collection>
次に、DeptNo に基づいて次の出力 xml ファイルが必要です。同じ場合は Subjectno を確認し、同じ場合は教師を件名に追加します。Subject と Dept についても同じことを行います。出力ファイルは次のようになります。
<Collection>
<DeptList>
<DeptNo>5613</DeptNo>
<DeptName>Computers</DeptName>
<SubjectList>
<SubjectNo>234</SubjectNo>
<SubjectName>XML</SubjectName>
<TeacherList>
<Teacher>Sai</Teacher>
</TeacherList>
</SubjectList>
<SubjectList>
<SubjectNo>239</SubjectNo>
<SubjectName>XSLT</SubjectName>
<TeacherList>
<Teacher>Suri</Teacher>
</TeacherList>
</SubjectList>
</DeptList>
<DeptList>
<DeptNo>5617</DeptNo>
<DeptName>Electronics</DeptName>
<SubjectList>
<SubjectNo>789</SubjectNo>
<SubjectName>Circuits</SubjectName>
<TeacherList>
<Teacher>Hari</Teacher>
<Teacher>Bharat</Teacher>
</TeacherList>
</SubjectList>
</DeptList>
<DeptList>
<DeptNo>5689</DeptNo>
<DeptName>Maths</DeptName>
<SubjectList>
<SubjectNo>749</SubjectNo>
<SubjectName>Trigonometry</SubjectName>
<TeacherList>
<Teacher>Arya</Teacher>
</TeacherList>
</SubjectList>
</DeptList>
</Collection>