Catmandu::XML::Transformer - Utility module for XML/XSLT processing
$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
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.
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 to string.
dom
string
struct
simple
<xsl:output method="text"/>
Returns an array reference of XSLT filenames used as transformation pipeline.
Returns the output format or undef.
undef
XML::Struct
To install Catmandu::XML, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Catmandu::XML
CPAN shell
perl -MCPAN -e shell install Catmandu::XML
For more information on module installation, please visit the detailed CPAN module installation guide.