xsl-list
[Top] [All Lists]

Re: [xsl] Applying XSL transformation to non-xml (but fixed structure) file

2010-06-02 06:32:57
On 02/06/2010 11:32, Christian Schouten wrote:
Hi all,

I need to apply an XSL transformation to a non-xml file that has a fixed
structure.
The goal is to read in the file, add/edit/delete a record and write it
back.

A sample file (start to finish) is as below:

It's very hard to judge from one sample file what is the range of possible inputs that your program needs to deal with; in particular, whether you can get by with a simple line-by-line analysis using regular expressions, or whether you need to do full recursive parsing based on a BNF grammar. Superficially, it looks like the second case, but I might be misjudging. The answer to this question fundamentally affects the design approach you adopt. In the second case, I would recommend writing a parser for the input format (perhaps using a tool such as JavaCC) that converts it into XML, and then write the XSLT transformation to process the resulting XML.

Michael Kay
Saxonica

--~------------------------------------------------------------------
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>
--~--