Subject: RE: [xsl] Converting a Batch File to XML From: "James Petry" <jpetry@xxxxxxxxx> Date: Mon, 26 Jul 2004 10:40:19 +0100 |
> 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Converting a Batch File t, gfranco | Thread | Re: [xsl] Converting a Batch File t, Garvin Franco |
Re: [xsl] Select parent node, David Carlisle | Date | [xsl] New XPath 2.0 drafts, Michael Kay |
Month |