NAME
Catmandu::XML::Transformer - Utility module for XML/XSLT processing
SYNOPISIS
$transformer
= Catamandu::XML::Transformer->new(
stylesheet
=>
'file.xsl'
);
$xml_string
=
$transformer
->transform(
$xml_string
);
# SCALAR
$xml_dom
=
$transformer
->transform(
$xml_dom
);
# XML::LibXML::Document
$xml_struct
=
$transformer
->transform(
$xml_struct
);
# ARRAY reference
$xml_simple
=
$transformer
->transform(
$xml_simple
);
# HASH reference
$transformer
= Catamandu::XML::Transformer->new(
output_format
=>
'string'
);
$xml_string
=
$transformer
->transform(
$xml
);
# any XML to SCALAR
CONFIGURATION
- stylesheet
-
Zero or more XSLT files given as comma-separated list of files or array reference with multiple files to apply as transformation pipeline. Files are parsed once on instantiation of the Catmandu::XML::Transformer object.
- output_format
-
Expected output format
dom
,string
,struct
,simple
. By default the input format triggers the output format. If the last stylesheet has text output (<xsl:output method="text"/>
) then output format is automatically set tostring
.
METHODS
- stylesheet()
-
Returns an array reference of XSLT filenames used as transformation pipeline.
- output_format()
-
Returns the output format or
undef
.