the line just before line 9 in the xsl file is: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.
If I fix that tag I get</xsl:template
That lead me to fix the code like this: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.
Which comes kind of close to the desired output: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;
Personally, I would use XML::Twig and Text::xSV / Text::CSV for this kind of thing.KCNU2073828479792101708/20/200714:0008/20/2007 09:45:00 KCOU10071877975751901308/20/200714:0008/20/2007 09:45:00
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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |