RE: [xsl] Read data from a text file through XSLT template

Subject: RE: [xsl] Read data from a text file through XSLT template
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 3 Aug 2005 11:31:06 +0100
In XSLT 2.0, the unparsed-text() function makes this straightforward. Use
unparsed-text() to read the file, tokenize() to split it into lines, and
then further calls on tokenize() or xsl:analyze-string to parse the contents
of each line.

In XSLT 1.0, you can read a flat text file by pretending that it's an XML
external entity, and referencing it from an XML document that causes the
entity to be expanded. Parsing the content of the file will then typically
require recursive templates, but you may be able to reuse the existing code
in the EXSLT template library.

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

> -----Original Message-----
> From: Khorasani, Houman [mailto:houman_khorasani@xxxxxxxxxxxxxx] 
> Sent: 03 August 2005 10:16
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] Read data from a text file through XSLT template
> 
> Hello,
> 
> I am assigned with a task to access a file through my XSLT 
> template and
> read line by line the usernames/passwords from the flat text file and
> store them into a variable. Or even access a database in order to get
> the username/password and store it into a variable.
> 
> This variable will be used for the further transformation / XML
> generation.
> Is that possible?  I couldn't find anything useful yet in internet.
> 
> Many thanks,
> Houman

Current Thread