Thanks for taking your time to hear to my concern.
I've been recently playing with some XSLT for various
templating and other reasons. I have also spent some time
on the web trying to learn about the beast and also how
it is used in Perl. Unfortunately, I couldn't find plenty
good information on the use of the
XML::XSLT perl module.
Not even in the native perldoc! ;/.
Anyhow, could you please explain me what is wrong with this code?
This is the real deal and only used for testing purposes while
I'm still learning how to use
XML::XSLT. So, in this
example, I'm first parsing an XML 'string' (saved in a scalar
variable), which works just fine. Next, I'm trying to parse
an XSL file 'Data/verysimple.xsl' that contains the exact
same XSL 'string'. However, this second time the parser reports
this error (this is the script's output actually):
XSL string parsed!
Error while parsing:
not well-formed (invalid token) at line 1, column 4, byte 4 at /Citygu
+ides/local/lib/perl5/site_perl/5.6.1/sun4-solaris/XML/Parser.pm line
+185
Data/verysimple.xml at /export/home/vlad/scratch/LIB/XML/XSLT.pm line
+1150.
Here's the actual code:
use XML::XSLT;
my $simple_xsl = qq~<?xml version="1.0"?>
<xsl:stylesheet>
<xsl:template match="/">
<html>
<xsl:apply-templates/>
</html>
</xsl:template>
</xsl:stylesheet>
~;
my $source = new XML::XSLT($simple_xsl);
print "XSL string parsed!\n";
my $source1 = new XML::XSLT('Data/verysimple.xml');
print "XSL file parsed!\n";
Update:
Thanks for all your comments. In fact all of the comments are correct. In this particular instance, I indeed failed to provide proper file name. Nontheless, the module couldn't parse any other xml file (actual deal) that I had to parse. Also, it had very poor error reporting (say, if I made a syntax error in my XML at line 100 or so, it would still continue saying that the error is at line 1 ;/). I've now installed libxml2 and libxsml libraries and also trying to install XML::LibXML and XML::LibXSLT as per your comments. I'm sincerely appreciative of your support! :-)
_____________________
# Under Construction
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.