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.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.