Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Tip of the Day
Language: XSLT
Expertise: Advanced
Sep 13, 2006



Application Security Testing: An Integral Part of DevOps

Read the First Line of a Text File

This code shows you how to use the instance methods from the FileReader and BufferedReader classes with a Xalan 2 processor to read the first line from a text file.

<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet version="1.0" xmlns:xsl=
<xsl:output method="html" version="4.01" encoding="ISO-8859-1" indent="yes" media-
type="text/html" />	          
<xsl:variable name="file_reader" select=
"FR:new(string('C://Data_Local//XML//XSLT//in.txt'))" />
<xsl:variable name="buffered_reader" select="BR:new($file_reader)" />
<xsl:variable name="read" select="BR:readLine($buffered_reader)" />

<xsl:template  match="/">	
     <h3><xsl:value-of select="$read" /></h3>	
Note: This tip was tested on Xalan, version 2.7.0.

Leonard Anghel
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.
Thanks for your registration, follow us on our social networks to keep up-to-date