Subject: Xalan-based flat file mapper
From: "Paul Brown" <prb@xxxxxxxxxxxxx>
Date: Tue, 20 Mar 2001 12:40:14 -0600
|
(cross-posted to xalan-dev)
I spent a couple of hours on the weekend looking over the current SQL
extensions for Xalan J2 and wrote a parallel extension for line-by-line
access to an InputStream (or file). That is, you can apply a template to
"$foo/stream/line" and iterate over the lines in the stream. (I also made
some trivial modifications to the fake document node to allow functions that
return a NodeSet (TEXT_NODEs only) to be run within it.)
Combined with a tokenizer that respects adjacent tokens (equivalent to
Benoit Cerrina's "tokenize" that ships with the current distribution but
with a different underlying tokenizer) and the XSLT substring() function,
the result is a simple command-line tool for mapping (multi-)delimited or
fixed-width files to XML.
GPL'd Java source (along with companion command-line scripts) here:
http://www.fivesight.com/downloads/xsltflatfile.asp
Cheers,
Paul Brown
FiveSight Technologies, Inc.
prb@xxxxxxxxxxxxx
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|