Catman...former(3pm)
π Catmandu::XML::Transformer π
okay so bestie, welcome to the manual for Catmandu::XML::Transformer, a lil utility module for XML/XSLT processing β¨ (the man page calls itself Catman...former(3pm) up top, which is giving truncated-filename realness, and it lives in the User Contributed Perl Documentation section π«Ά).
β¨ SYNOPSIS β¨
here's the whole vibe, no cap:
$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
likeβ¦ you build a transformer, you hand it XML, you get XML back. iconic behaviour tbh π
πΈ CONFIGURATION πΈ
the options you can pass when you make one, mwah π
stylesheetβ zero or more XSLT files π. you can give them as a comma-separated list of files, or as an array reference holding multiple files, and they get applied as a transformation pipeline. the files get parsed once, on instantiation of theCatmandu::XML::Transformerobject β so like, not every single time you calltransform, okay? efficient queen πoutput_formatβ the output format you're expecting:"dom","string","struct", or"simple"β. by default the input format is what triggers the output format. BUT β and this is the plot twist β if the last stylesheet has text output (i.e.<xsl:output method="text"/>), then the output format gets automatically set to"string"π¦
π METHODS π
the methods, bestie, they're right here:
stylesheet()β returns an array reference of the XSLT filenames being used as the transformation pipeline πoutput_format()β returns the output format, orundefπ (yes, it can just beundef. it's fine. it's giving mystery.)
π«Ά SEE ALSO π«Ά
- XML::Struct
that's the whole page, you ate it, periodt π
signing off: this was perl v5.36.0, dated 2022-09-15, still serving Catman...former(3pm) energy forever πβ¨ no cap.
π¦ where this page comes from
- ubuntu noble: libcatmandu-xml-perl 0.17-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libcatmandu-xml-perl 0.17-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libcatmandu-xml-perl 0.17-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms