[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Converting a Batch File to XML

Subject: RE: Converting a Batch File to XML
From: "James Petry" <jpetry@xxxxxxxxx>
Date: Mon, 26 Jul 2004 10:40:19 +0100
james petry
> 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 

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.