use XML::SAX::Machines qw( Pipeline ); use XML::Filter::Sort; use XML::Filter::XSLT; my $xslt_filter = XML::Filter::XSLT->new; $xslt_filter->set_stylesheet_uri("report.xslt"); my $sort_keys = [ [ 'surname', 'alpha', 'asc' ], [ 'first-name', 'alpha', 'asc' ], ]; Pipeline( '<data.xml' => XML::Filter::Sort->new( Record => 'person', Keys => $sort_keys, IgnoreCase => 1 ) => $xslt_filter => 'XML::Filter::Reindent' => '>report.html' )->parse;