#!/usr/bin/perl -wT
use strict;
use XML::LibXSLT;
use XML::LibXML;
my $page2 = "
First title
Other stuff
Second title
More other stuff
";
my $parser = XML::LibXML->new();
my $xslt = XML::LibXSLT->new();
# assumes you've got the XML doc as a string in $page2
my $source = $parser->parse_string($page2);
# assumes your XSL file is convert.xsl
my $style_doc = $parser->parse_file('convert.xsl');
my $stylesheet = $xslt->parse_stylesheet($style_doc);
my $results = $stylesheet->transform($source);
print $stylesheet->output_string($results);
####
A
C
##
##
AFirst titleCASecond titleC