use XML::LibXML;
use XML::LibXSLT;
use strict;


my $parser = new XML::LibXML;
my $xslt   = new XML::LibXSLT;

$parser -> expand_entities (0);
$parser -> load_ext_dtd (0);
 
my $result;
       
my $stylesheet = shift;
my $source     = shift;

eval 
  {
    my $source = $parser -> parse_file ("$source");
    my $style_doc = $parser -> parse_file ("$stylesheet");
    my $stylesheet = $xslt -> parse_stylesheet($style_doc);
    my $results = $stylesheet -> transform($source);

    $result = $stylesheet -> output_string($results);
  };

if( $@ ) {
  warn $@;
} else {
  print $result;
}

