|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Converting a Batch File to XML
> From: gfranco [mailto:garvin_franco@xxxxxxxxxxx] > We want to be able to write the style sheet once > and use in other places across the organization, and this is > why a style sheet, rather than a proprietary tool is more > appealing to us. So if anyone else has any other ideas, I > would really appreciate your thoughts.... you want to maximize the work you do in XML. Convert the text into some simple XML format, such as <root> <H>A-HEADER<H> <I>AN-ITEM-1</I> <S>A-SUMMARY-1</S> ... </root> then use XSLT 1.0 grouping techniques to do the rest of the work. Fortunately, your text file looks straightforward to parse. For text to XML, I use perl as it's open, compact and runs well on Unix and Windows. #!perl -w print "<root>\n"; while (<>) { chomp(); $tag = substr($_, 0, 1); print "<$tag>", substr($_, 2), "</$tag>\n"; } print "</root>\n"; I saved this in a file called t.pl and ran it like this: perl t.pl input.txt Best Wishes, James -- "Be excellent to each other", Bill & Ted
|
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
|

Cart








