newbie
newbie

Reputation: 261

Converting txt to xml through XSLT

I got an use case and exploring XSLT. I have text file with tab delimited data. as following -

column1 column2 column3
name1    age1    addr1
name2    age2    addr2
name3    age3    addr3

Could somebody please help me how to transform this text to following xml using XSLT 1.0 & XSLT 2.0 .

<table>
  <row id=1> 
    <column1>name1</column1>
    <column2>age1</column2>
    <column3>addr1</column3>
  </row>
  <row id=2> 
    <column1>name2</column1>
    <column2>age2</column2>
    <column3>addr2</column3>
  </row>
  <row id=3> 
    <column1>name3</column1>
    <column2>age3</column2>
    <column3>addr3</column3>
  </row>
</table>   

Upvotes: 1

Views: 441

Answers (1)

G. Ken Holman
G. Ken Holman

Reputation: 4403

Please find a tab-separated-values (TSV) text file to XML converter using XSLT 2 here:

http://www.CraneSoftwrights.com/resources/#csv

It is designed to be used either standalone or imported into another stylesheet.

Upvotes: 3

Related Questions