[Templates] Hello; Only first template in alphabetical order parses successfully with XSLT

Berk Birand berkbirand@superonline.com
Wed, 05 Jul 2006 05:26:37 +0300


Hi everyone,

I just subscribed to this mailing list, although I've been using the 
Template Toolkit for a while. After spending hours trying to figure out 
the solution to my problems, I made some ridiculous observations that I 
do not want to believe.

First some background. I use TT2 to statically generated my personal web 
page. Everything went wonderfully until I ventured with XML and the XSLT 
plugin. I put the entire menu structure in a menu.xml file, and also 
ported some other sections. I then discovered the XSLT plugin (which I 
was planning on writing myself), and started playing around with it. At 
first, everything worked as usual, but as I used more template relying 
on XML transformations, unexpected errors surfaced.

The ridiculous observation that I promised is the following. When using 
ttree to generate the entire hierarchy, only the first template (in 
alphabetical order) that uses the XSLT plugin parses successfully. For 
instance I mainly have three template that use it: index.html, 
news_archive.html and gallery.html. When I run ttree, only index.html is 
successfully converted, and the two others fail with the following 
cryptic errors (I added the "Plugin" and "File __exists" lines to 
XSLT.pm for debugging):

   + index.html
Plugin:file:etc/xsl/news.xsl
File etc/xsl/news.xsl exist
   + news_archive.html
Plugin:file:etc/xsl/news_archive.html.xsl
File etc/xsl/news_archive.html.xsl exist
   ! plugin error - XSLT plugin failed: Stylesheet parsing error: 
Couldn't create file parser context for file "etc/xsl/news_archive.html.xsl
": No such file or directory at 
/usr/lib/perl5/vendor_perl/5.8.7/i386-linux/XML/LibXML.pm line 435.
  at /usr/lib/perl5/site_perl/5.8.7/Template/Plugin/XSLT.pm line 27
   + gallery.html
Plugin:file:etc/xsl/gallery.html.xsl
File etc/xsl/gallery.html.xsl exist
   ! plugin error - XSLT plugin failed: Stylesheet parsing error: 
Couldn't create file parser context for file "etc/xsl/gallery.html.xsl": Su
ccess at /usr/lib/perl5/vendor_perl/5.8.7/i386-linux/XML/LibXML.pm line 435.
  at /usr/lib/perl5/site_perl/5.8.7/Template/Plugin/XSLT.pm line 27

Now when I rename index.html to zindex.html, guess what happens:

   + news_archive.html
Plugin:file:etc/xsl/news_archive.html.xsl
File etc/xsl/news_archive.html.xsl exist
   + zindex.html
Plugin:file:etc/xsl/news.xsl
File etc/xsl/news.xsl exist
   ! plugin error - XSLT plugin failed: Stylesheet parsing error: 
Couldn't create file parser context for file "etc/xsl/news.xsl": No such fi
le or directory at 
/usr/lib/perl5/vendor_perl/5.8.7/i386-linux/XML/LibXML.pm line 435.
  at /usr/lib/perl5/site_perl/5.8.7/Template/Plugin/XSLT.pm line 27
   + gallery.html
Plugin:file:etc/xsl/gallery.html.xsl
File etc/xsl/gallery.html.xsl exist
   ! plugin error - XSLT plugin failed: Stylesheet parsing error: 
Couldn't create file parser context for file "etc/xsl/gallery.html.xsl": Su
ccess at /usr/lib/perl5/vendor_perl/5.8.7/i386-linux/XML/LibXML.pm line 435.
  at /usr/lib/perl5/site_perl/5.8.7/Template/Plugin/XSLT.pm line 27


This time, news_archive.html works, but zindex.html does!!! What do you 
make out of this? Is there some kind of destructor missing between the 
invocations or something? Since I am not that familiar with Filters, 
this seems really odd to me.

Thanks,
Berk Birand