[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Read data from a text file through XSLT template
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: 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|