http://qs1969.pair.com?node_id=450975

bosshoff has asked for the wisdom of the Perl Monks concerning the following question:

Hello,
This is my first post on Perl Monks. Basically, my problem is with the XML::XSLT perl module. I have the following code:
use strict; use XML::XSLT; print "Content-type: text/html\n\n"; open (XSL, "blog.xsl"); my $xslFile = ""; while(<XSL>) { $xslFile .= $_; } close(XSL); #my $xslFile = get("blog.xsl") || die qq(No feed "blog.xsl": $!); my $xslt = XML::XSLT->new ($xslFile); #, warnings => 1, debug => 1) or + die qq(Something Happened); my $xmlFile = ""; open (XML, "posts.xml"); while(<XML>) { $xmlFile .= $_; } close(XML); #print $xslt->serve $xmlFile; $xslt->transform ($xmlFile); print $xslt->toString; $xslt->dispose();
Which produces the following error when run:

no element found at line 1, column 0, byte -1 at /usr/lib/perl5/vendor_perl/5.8.6/i686-linux/XML/Parser.pm line 187

I have tried everything. The contents of the $xmlFile and $xslFile are all there (ie: there isn't a problem filling these vars with content). Processing these two files with Xalan takes less than a second and produces exactly what I want. The reason I can't use Xalan is because my web host only has XML::XSLT available. Thanks for the help.