RE: [xsl] TEXT flat file as input

Subject: RE: [xsl] TEXT flat file as input
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Mon, 5 Jun 2006 09:53:49 +0100
In XSLT 2.0 this is straightforward. You can use unparsed-text() to read the
text file, and tokenize() to split it into records and fields.

In 1.0 it's a bit more convoluted. You first need to turn it into XML (by
adding a trivial start and end tag), then you need to process it using
recursive templates. But it's almost certainly possible to find reusable
code that can do this.

Michael Kay
http://www.saxonica.com/ 

> -----Original Message-----
> From: Khorasani, Houman [mailto:Houman.Khorasani@xxxxxxxxxxxx] 
> Sent: 05 June 2006 09:48
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] TEXT flat file as input
> 
> Sofar I have always used XSLT to transform from XML to XML.
> 
> I am working on a new project where the input file is in a text flat
> file:
> 
> account_no,123456,subscr_no,654321
> 
> Is it possible to read such a file with XSLT and transform 
> the first field until the comma into an XML element and put 
> the second field as its value and etc?
> 
> Is this a reliable way to do that?
> 
> Many Thanks,
> Houman

Current Thread