I'm using XML::Parser 2.34 and XML::XSLT 0.48 (that's the current version). And my error message is a little more specific (note that I changed the names of the input files):

perl test.pl Error while parsing: not well-formed (invalid token) at line 9, column 0, byte 244 at /usr/ +local/lib/perl5/site_perl/5.8.5/i686-linux-thread-multi/XML/Parser.pm + line 187 input.xsl at /usr/local/lib/perl5/site_perl/5.8.8/XML/XSLT.pm line 150 +7.
the line just before line 9 in the xsl file is:
</xsl:template
If I fix that tag I get
Argument syntax of call to XML::XSLT::transform deprecated. See the d +ocumentation for XML::XSLT::transform at test.pl line 9 Error while parsing: syntax error at line 1, column 0, byte 0 at /usr/local/lib/perl5/site_ +perl/5.8.5/i686-linux-thread-multi/XML/Parser.pm line 187 XMLFile at /usr/local/lib/perl5/site_perl/5.8.8/XML/XSLT.pm line 1507.
That lead me to fix the code like this:
use strict; use XML::XSLT; my $xmlFilename = 'input.xml'; my $xslFilename = 'input.xsl'; (my $outFilename = $xmlFilename) =~ s/\.xml$/\.csv/i; my $xslt = XML::XSLT->new($xslFilename, warnings => 1); $xslt->transform($xmlFilename); print $xslt->toString;
Which comes kind of close to the desired output:

KCNU2073828479792101708/20/200714:0008/20/2007 09:45:00 KCOU10071877975751901308/20/200714:0008/20/2007 09:45:00
Personally, I would use XML::Twig and Text::xSV / Text::CSV for this kind of thing.

update: in any case you should probably make sure you've got the latest stable versions of both XML::XSTL and XML::Parser.


In reply to Re: Using XML::XSLT to convert XML to CSV by Joost
in thread Using XML::XSLT to convert XML to CSV by Photius

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.