in reply to Re: Using XML::XSLT to convert XML to CSV
in thread Using XML::XSLT to convert XML to CSV

Joost, thanks for spotting the missing > and for your advice.

I was still getting the same error after fixing that, though.
I found the cause. It works fine as long as the input.xml filename and input.xsl filename do *not* have a path in front of them. I am on a Windows platform and have tried the formats:
'C:/mypath/input.xml'
'C:\mypath\input.xml'
"C:/mypath/input.xml"
"C:\\mypath\\input.xml"

It seems it can only accept files in the current directory??
  • Comment on Re^2: Using XML::XSLT to convert XML to CSV

Replies are listed 'Best First'.
Re^3: Using XML::XSLT to convert XML to CSV
by Joost (Canon) on Aug 21, 2007 at 22:11 UTC
    I'm not sure what the problem could be (and I don't have a windows perl available at the moment) but this works for me on linux:
    use strict; use XML::XSLT; my $xmlFilename = '/home/joost/input.xml'; my $xslFilename = '/home/joost/input.xsl'; (my $outFilename = $xmlFilename) =~ s/\.xml$/\.csv/i; my $xslt = XML::XSLT->new($xslFilename, warnings => 1); $xslt->transform($xmlFilename); print $xslt->toString;
    Can't help you much further than that, though.

    update: did you update the XML modules, or where they already at the latest version?

    You can check by doing

    perl -MXML::XSLT -e'print "$XML::XSLT::VERSION\n"'
    and similar for XML::Parser
      When I paste the above in my Windows XP command line to check the version, I get:
      Can't find string terminator "'" anywhere before EOF at -e line 1.
      However, I put this in a script file:
      use XML::XSLT; print "$XML::XSLT::VERSION\n";
      and then it prints:
      0.48
        also
        XML::Parser version is 2.34
Re^3: Using XML::XSLT to convert XML to CSV
by Cody Pendant (Prior) on Aug 22, 2007 at 00:45 UTC
    On the one hand, the documentation says you should use "base" as an argument to the transform call.

    On the other hand, I tried that and I still get that error.



    Nobody says perl looks like line-noise any more
    kids today don't know what line-noise IS ...
Re^3: Using XML::XSLT to convert XML to CSV
by Anonymous Monk on Sep 02, 2011 at 21:47 UTC

    hey,

    i had the same problem using parser.pm on windows xp machine for absolute paths.

    solved by adding "file:///" on the beginning of the path

    ex: XML::XSLT->new ("file:///C:/mypath/to/something.xsl" );