I want to transform a XML into a readable HTML. Below I am putting a sample part of my XML that I am unable to transform myself and needs some help.
The XML may have a variable number of columns that will be generated by the name col1,col2---colxxx. Here If ITEM=Label I am adding before their names
I want to put all the <nonLog> records in one table and all the <log> records in another from wise.
That means
We will have
Non-Logs for form 1
Logs for form 1
Non-logs for form 2
then Logs for from 2 .. so on and so fourth
<Post>
<FormData>
<SUBJECT>94</SUBJECT>
<FORM_OID>TOX</FORM_OID>
<NonLog>
<ID>1</ID>
<SUBJECT_ID>94</SUBJECT_ID>
<FORM_OID>TOX</FORM_OID>
<ITEM>Label</ITEM>
<col1>Visit</col1>
<col2> AV</col2>
<col3>AC</col3>
</NonLog>
<NonLog>
<ID>2</ID>
<SUBJECT_ID>94</SUBJECT_ID>
<FORM_OID>TOX</FORM_OID>
<ITEM>Data</ITEM>
<col1>1t</col1>
<col2>No</col2>
<col3></col3>
</NonLog>
<Log>
<ID>5</ID>
<SUBJECT_ID>94</SUBJECT_ID>
<FORM_OID>TOX</FORM_OID>
<ITEM>Label</ITEM>
<LOG_REC_POSITION>1</LOG_REC_POSITION>
<col1>Pat Name</col1>
<col2>Doc Name</col2>
</Log>
<Log>
<ID>5</ID>
<SUBJECT_ID>94</SUBJECT_ID>
<FORM_OID>TOX</FORM_OID>
<ITEM>Label</ITEM>
<LOG_REC_POSITION>1</LOG_REC_POSITION>
<col1>Sam</col1>
<col2>Dr Mike</col2>
</Log>
</Form Data>
<FormData>
<SUBJECT>94</SUBJECT>
<FORM_OID>TOX2</FORM_OID>
<NonLog>
<ID>1</ID>
<SUBJECT_ID>94</SUBJECT_ID>
<FORM_OID>TOX2</FORM_OID>
<ITEM>Label</ITEM>
<col1>Visit</col1>
<col2> AV</col2>
<col3>AC</col3>
</NonLog>
<NonLog>
<ID>2</ID>
<SUBJECT_ID>94</SUBJECT_ID>
<FORM_OID>TOX2</FORM_OID>
<ITEM>Data</ITEM>
<col1>1t</col1>
<col2>No</col2>
<col3></col3>
</NonLog>
<Log>
<ID>5</ID>
<SUBJECT_ID>94</SUBJECT_ID>
<FORM_OID>TOX2</FORM_OID>
<ITEM>Label</ITEM>
<LOG_REC_POSITION>1</LOG_REC_POSITION>
<col1>Pat Name</col1>
<col2>Doc Name</col2>
</Log>
<Log>
<ID>5</ID>
<SUBJECT_ID>94</SUBJECT_ID>
<FORM_OID>TOX2</FORM_OID>
<ITEM>Label</ITEM>
<LOG_REC_POSITION>1</LOG_REC_POSITION>
<col1>Sam</col1>
<col2>Dr Mike</col2>
</Log>
</Form Data>
</Post>
The expected output HTML is
<Table>
<tr><td>
<table>
<tr><td><b>visit no</b></td></tr>
<tr><td>1</td></tr>
<tr><td><b>Date</b></td></tr>
<tr><td>8/11/2018</td></tr>
</table>
</td></tr>
<table>
<tr><td><b>Pat Name</b></td><td><b>Doc Name</b></td></tr>
<tr><td>Sam Hul</td><td>Dr Mike</td></tr>
</table><table>
<tr><td><b>visit no</b></td></tr>
<tr><td>1</td></tr>
<tr><td><b>Date</b></td></tr>
<tr><td>8/11/2018</td></tr>
</table>
</td></tr>
<table>
<tr><td><b>Pat Name</b></td><td><b>Doc Name</b></td></tr>
<tr><td>Sam Hul</td><td>Dr Mike</td></tr>
</table>
</table>