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.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|