Here is a Perl snippet that transforms an XML file with XSLT:
use strict;
use XML::XSLT::Wrapper;
my $xml_input_filename = "xml/data.xml";
my $xml_output_filename = "xml/out.xml";
my $xsl_filename = "xml/transform.xslt";
my $xslt = XML::XSLT::Wrapper->new(
ProcessorList => [
'libxslt',
'sablotron',
'xslt'
],
);
my $result = $xslt->transform(
OutFile => $xml_output_filename,
xml => $xml_input_filename,
xsl => $xsl_filename,
);
$xslt->dispose();
Values given to [code]]czo2OlwieG1sID0+XCI7e1smKiZdfQ==[[/code] and [code]]czo2OlwieHNsID0+XCI7e1smKiZdfQ==[[/code] can be either file names, or xml/xslt code passed as a string.
If [code]]czo3OlwiT3V0RmlsZVwiO3tbJiomXX0=[[/code] is ommited, then the result of the transformation is returned to the variable [code]]czo3OlwiJHJlc3VsdFwiO3tbJiomXX0=[[/code].
XSLT transform with Perl
Here is a Perl snippet that transforms an XML file with XSLT:
Values given to [code]]czo2OlwieG1sID0+XCI7e1smKiZdfQ==[[/code] and [code]]czo2OlwieHNsID0+XCI7e1smKiZdfQ==[[/code] can be either file names, or xml/xslt code passed as a string.
If [code]]czo3OlwiT3V0RmlsZVwiO3tbJiomXX0=[[/code] is ommited, then the result of the transformation is returned to the variable [code]]czo3OlwiJHJlc3VsdFwiO3tbJiomXX0=[[/code].