Subject: | LibXSLT SEGVs on invalid xsl:stylesheet element |
Distribution XML-LibXSLT-1.31 (from Randy Kobes repository)
Perl Binary build 628 provided by ActiveState Tool Corp. http://www.ActiveState.com
Built 15:41:05 Jul 4 2001
Any error in the <xsl:stylesheet> element within a stylesheet causes LibXSLT to SEGV. This error came up on the Perl-XML list in mid-December raised by Roger Perttu, but I thought that I'd log it here anyway. Here's an example, I set the version to 2.0, it should be 1.0:
use strict;
use warnings;
use XML::LibXML;
use XML::LibXSLT;
my $doc = XML::LibXML->new->parse_string(<<EOT);
<?xml version="1.0"?>
<dromedaries>
</dromedaries>
EOT
my $templateDoc = XML::LibXML->new->parse_string(<<EOT);
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version = "2.0">
<xsl:template match="/">
</xsl:template>
</xsl:stylesheet>
EOT
my $stylesheet;
eval {
$stylesheet = XML::LibXSLT->new->parse_stylesheet($templateDoc);
};
die $@ if $@;
my $resultDoc = $stylesheet->transform($doc);
print $stylesheet->output_string($resultDoc);