Hi,
How can i convert this xml file into target xml using xslt. I tried everything, but i am not able to put the subquestions inside the corresponding questions. Please help even the logic.
INPUT XML:
<?xml version="1.0" encoding="UTF-8"?>
<tables>
<table>
<tr>
<tc>
<data>
This is the title of the table.
</data>
</tc>
</tr>
<tr>
<tc>
<data>
1. Question
</data>
</tc>
</tr>
<tr>
<tc>
<data>
2. Question
</data>
</tc>
</tr>
<tr>
<tc>
<data>
(Subquestion1)
</data>
</tc>
</tr>
<tr>
<tc>
<data>
(Subquestion2)
</data>
</tc>
</tr>
<tr>
<tc>
<data>
3. Question
</data>
</tc>
</tr>
<tr>
<tc>
<data>
(Subquestion1)
</data>
</tc>
</tr>
<tr>
<tc>
<data>
4. Question
</data>
</tc>
</tr>
</table>
<table>
<tr>
<tc>
<data>
This is the title of the table.
</data>
</tc>
</tr>
<tr>
<tc>
<data>
1. Question
</data>
</tc>
</tr>
<tr>
<tc>
<data>
(Subquestion)
</data>
</tc>
</tr>
<tr>
<tc>
<data>
(Subquestion)
</data>
</tc>
</tr>
<tr>
<tc>
<data>
2. Question
</data>
</tc>
</tr>
<tr>
<tc>
<data>
3. Question
</data>
</tc>
</tr>
<tr>
<tc>
<data>
(Subquestion)
</data>
</tc>
</tr>
<tr>
<tc>
<data>
4. Question
</data>
</tc>
</tr>
</table>
</tables>
Target XML:
<?xml version="1.0" encoding="UTF-8"?>
<Sections>
<section title="This is the title of the table.">
<Questions>
<Question>
1.Question
</Question>
<Question>
2.Question
<SubQuestion>
Subquestion1
</SubQuestion>
<SubQuestion>
Subquestion2
</SubQuestion>
</Question>
<Question>
3.Question
<SubQuestion>
Subquestion1
</SubQuestion>
</Question>
<Question>
4.Question
</Question>
</Questions>
</section>
<section title="This is the title of the table.">
<Questions>
<Question>
1.Question
<SubQuestion>
Subquestion1
</SubQuestion>
<SubQuestion>
Subquestion2
</SubQuestion>
</Question>
<Question>
2.Question
</Question>
<Question>
3.Question
<SubQuestion>
Subquestion
</SubQuestion>
</Question>
<Question>
4.Question
</Question>
</Questions>
</section>
</Sections>