I would like to translate a tab-delimited file into XML using XSL.
I would like to prepend and append an XML wrapper to it, then use string functions to parse it. However, I'm not skilled in this, and have wasted much time. The notation "tab" means that there is a tab character in the line.
By the way, you see five columns, but there could be more.
You see three rows, but there could be more than fifty.
Thanks a lot,
--SMerrill
Here is the source file:
[tt]
<?xml version="1.0"?>
<root>
RUNORDtabPRESSINtabFLOW_INtabBACK_PRtabMETHANE
5tab300tab20tab137.5tab8.6
20tab300tab20tab137.5tab10.1
28tab800tab500tab137.5tab19.8
</root>
[/tt]
Here is the desired result:
[tt]
<?xml version="1.0"?>
<root>
<titles>
<title>RUNORD</title>
<title>PRESSIN</title>
<title>FLOW_IN</title>
<title>BACK_PR</title>
<title>METHANE</title>
</titles>
<row>
<RUNORD>5</RUNORD>
<PRESSIN>300</PRESSIN>
<FLOW_IN>20</FLOW_IN>
<BACK_PR>137.5</BACK_PR>
<METHANE>8.6</METHANE>
</row>
<row>
<RUNORD>20</RUNORD>
<PRESSIN>300</PRESSIN>
<FLOW_IN>20</FLOW_IN>
<BACK_PR>137.5</BACK_PR>
<METHANE>10.1</METHANE>
</row>
<row>
<RUNORD>28</RUNORD>
<PRESSIN>800</PRESSIN>
<FLOW_IN>500</FLOW_IN>
<BACK_PR>137.5</BACK_PR>
<METHANE>19.8</METHANE>
</row>
</root>
[/tt]
I would like to prepend and append an XML wrapper to it, then use string functions to parse it. However, I'm not skilled in this, and have wasted much time. The notation "tab" means that there is a tab character in the line.
By the way, you see five columns, but there could be more.
You see three rows, but there could be more than fifty.
Thanks a lot,
--SMerrill
Here is the source file:
[tt]
<?xml version="1.0"?>
<root>
RUNORDtabPRESSINtabFLOW_INtabBACK_PRtabMETHANE
5tab300tab20tab137.5tab8.6
20tab300tab20tab137.5tab10.1
28tab800tab500tab137.5tab19.8
</root>
[/tt]
Here is the desired result:
[tt]
<?xml version="1.0"?>
<root>
<titles>
<title>RUNORD</title>
<title>PRESSIN</title>
<title>FLOW_IN</title>
<title>BACK_PR</title>
<title>METHANE</title>
</titles>
<row>
<RUNORD>5</RUNORD>
<PRESSIN>300</PRESSIN>
<FLOW_IN>20</FLOW_IN>
<BACK_PR>137.5</BACK_PR>
<METHANE>8.6</METHANE>
</row>
<row>
<RUNORD>20</RUNORD>
<PRESSIN>300</PRESSIN>
<FLOW_IN>20</FLOW_IN>
<BACK_PR>137.5</BACK_PR>
<METHANE>10.1</METHANE>
</row>
<row>
<RUNORD>28</RUNORD>
<PRESSIN>800</PRESSIN>
<FLOW_IN>500</FLOW_IN>
<BACK_PR>137.5</BACK_PR>
<METHANE>19.8</METHANE>
</row>
</root>
[/tt]