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(_dot_)Khorasani(_at_)comverse(_dot_)com]
Sent: 05 June 2006 09:48
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
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
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail:
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--