in reply to XSLT to HTML/XHTML

There seems to be an issue with the line:
<xsl:variable name="level">0</xsl:variable>

It would work when you change it to:
<xsl:variable name="level" value="0" />

See also XML::XSLT problem

Replies are listed 'Best First'.
Re^2: XSLT to HTML/XHTML
by tej (Scribe) on Aug 05, 2011 at 09:17 UTC

    Thanks!! Now I dont get any error..

    But now i tried to print it to an output file like:
    use XML::XSLT; my $xsl="main.xsl"; my $xmlfile="main.xml"; my $xslt = XML::XSLT->new ($xsl, warnings => 1); $xslt->transform ($xmlfile); print $xslt->toString; ########### $main="main"; open (INF, ">$main.html")||warn ("Can not create file"); print INF $xslt; close INF; ############ $xslt->dispose();
    But when i open that HTML file i get output as XML::XSLT=HASH(0x248bdc)

    How can i print data to output file

    I tried installing XML::LibXSLT, however it is not installing on my system (version 5.12.2)

      $xslt is an object - you don't want to print that :) Instead try the below:

      $xslt->transform ($xmlfile); ########### $main="main.thml"; open (INF, ">$main")||warn ("Can not create file"); print INF $xslt->toString; close INF; ###########