Converting tab delimited files into EDI

001 Telephone 1 23.00
002 Desk 1 129.00
003 Keyboard 2 21.00
for $item in doc("converter:TAB:first=yes?file:///c:/sample.tab")//row
return $item/description
} </items>
<description>Telephone</description>
<description>Desk</description>
<description>Keyboard</description>
</items>
<X12>
<ISA>
<ISA06-InterchangeSenderId>1515151515</ISA06-InterchangeSenderId>
<ISA08-InterchangeReceiverId>5151515151</ISA08-InterchangeReceiverId>
<ISA11-RepetitionSeparator>^</ISA11-RepetitionSeparator>
<ISA13-InterchangeControlNumber>000032123</ISA13-InterchangeControlNumber>
<ISA14-AcknowledgmentRequested>0</ISA14-AcknowledgmentRequested>
<ISA15-UsageIndicator>P</ISA15-UsageIndicator>
<ISA16-ComponentElementSeparator>*</ISA16-ComponentElementSeparator>
</ISA>
<GS>
<GS01-FunctionalIdentifierCode>CT</GS01-FunctionalIdentifierCode>
<GS02-ApplicationSendersCode>9988776655</GS02-ApplicationSendersCode>
<GS03-ApplicationReceiversCode>1122334455</GS03-ApplicationReceiversCode>
<GS06-GroupControlNumber>128</GS06-GroupControlNumber>
<GS07-ResponsibleAgencyCode>X</GS07-ResponsibleAgencyCode>
<GS08-VersionReleaseIndustry>004030</GS08-VersionReleaseIndustry>
</GS>
<TS_832>
<ST>
<ST01-TransactionSetIdentifierCode>832</ST01-TransactionSetIdentifierCode>
<ST02-TransactionSetControlNumber>12345</ST02-TransactionSetControlNumber>
</ST>
<BCT>
<BCT01-CatalogPurposeCode>CP</BCT01-CatalogPurposeCode>
<BCT02-CatalogNumber>GOV56789</BCT02-CatalogNumber>
<BCT10-TransactionSetPurposeCode>00</BCT10-TransactionSetPurposeCode>
</BCT>
{
for $row in doc('converter:TAB:first=yes?file:///c:/sample.tab')/table/row
return
<GROUP_5>
<LIN>
<LIN02-ProductServiceIdQualifier>MF</LIN02-ProductServiceIdQualifier>
<LIN03-ProductServiceId>{$row/id/text()}</LIN03-ProductServiceId>
<LIN07-ProductServiceId>{$row/description/text()}</LIN07-ProductServiceId>
<LIN09-ProductServiceId>{$row/quantity/text()}</LIN09-ProductServiceId>
</LIN>
<GROUP_6>
<CTP>
<CTP03-UnitPrice>{$row/unitprice/text()}</CTP03-UnitPrice>
</CTP>
</GROUP_6>
</GROUP_5>
<SE/>
</TS_832>
<GE/>
</X12>
ISA+00+ +00+ +ZZ+1515151515 +ZZ+5151515151 +080129+1710+U+00000+000032123+0+P+*'
GS+CT+9988776655+1122334455+20080129+1710+128+X+004030'
ST+832+12345'
BCT+CP+GOV56789++++++++00'
LIN++MF+001++++Telephone++1'
CTP+++23'
LIN++MF+002++++Desk++1'
CTP+++129'
LIN++MF+003++++Keyboard++2'
CTP+++21'
SE+9+12345'
GE+1+128'
IEA+1+000032123'





