perldoc > XML::XSLT

📝 NAME

XML::XSLT - A perl module for processing XSLT

🚀 Quick Reference

Use CaseCommandDescription
Create XSLT processorXML::XSLT->new($xsl, %args)Return a new XSLT parser object with optional flags (warnings, variables, etc.)
Transform XML$xslt->transform($xml)Process XML through the stylesheet and return a DOM object
Get result as string$xslt->toStringReturn the transformed result as a string
Serve result with HTTP headers$xslt->serve($xml)Process XML and return result string with optional Content-Type and Content-Length headers
Reuse XSLT for new XML$xslt->open_xml($xml)Load new XML into the existing XSLT object
Change stylesheet$xslt->open_xsl($xsl)Replace the stylesheet in the XSLT object
Process with variables$xslt->process(%variables)Run transformation using previously loaded XML and stylesheet, with parameters

📖 SYNOPSIS

use XML::XSLT;

my $xslt = XML::XSLT->new($xsl, warnings => 1);

$xslt->transform($xmlfile);
print $xslt->toString;

$xslt->dispose();

📝 DESCRIPTION

This module implements the W3C's XSLT specification. The goal is full implementation of this spec, but we have not yet achieved that. However, it already works well. See "XML::XSLT Commands" for the current status of each command.

XML::XSLT makes use of XML::DOM and LWP::Simple, while XML::DOM uses XML::Parser. Therefore XML::Parser, XML::DOM and LWP::Simple have to be installed properly for XML::XSLT to run.

📂 Specifying Sources

The stylesheets and the documents may be passed as filenames, file handles, regular strings, string references or DOM-trees. Functions that require sources (e.g. new), will accept either a named parameter or simply the argument.

Either of the following are allowed:

my $xslt = XML::XSLT->new($xsl);
my $xslt = XML::XSLT->new(Source => $xsl);

In documentation, the named parameter Source is always shown, but it is never required.

📚 METHODS

🆕 new(Source => $xml [, %args])

Returns a new XSLT parser object. Valid flags are:

📂 open_xml(Source => $xml [, %args])

Gives the XSLT object new XML to process. Returns an XML::DOM object corresponding to the XML.

📂 open_xsl(Source => $xml [, %args])

Gives the XSLT object a new stylesheet to use in processing XML. Returns an XML::DOM object corresponding to the stylesheet. Any arguments present are passed to the XML::DOM::Parser.

⚙️ process(%variables)

Processes the previously loaded XML through the stylesheet using the variables set in the argument.

🔄 transform(Source => $xml [, %args])

Processes the given XML through the stylesheet. Returns an XML::DOM object corresponding to the transformed XML. Any arguments present are passed to the XML::DOM::Parser.

🚀 serve(Source => $xml [, %args])

Processes the given XML through the stylesheet. Returns a string containing the result. Example:

use XML::XSLT qw(serve);

$xslt = XML::XSLT->new($xsl);
print $xslt->serve $xml;

📝 xsl_output_method

Get or set the <xsl:output method= attribute. Valid arguments are 'html', 'text' and 'xml'.

📄 toString

Returns the result of transforming the XML with the stylesheet as a string.

📄 to_dom

Returns the result of transforming the XML with the stylesheet as an XML::DOM object.

📁 media_type

Returns the media type (aka mime type) of the object.

🗑️ dispose

Executes the "dispose" method on each XML::DOM object.

📋 XML::XSLT Commands

🆘 SUPPORT

General information, bug reporting tools, the latest version, mailing lists, etc. can be found at the XML::XSLT homepage:

http://xmlxslt.sourceforge.net/

⚠️ DEPRECATIONS

Methods and interfaces from previous versions that are not documented in this version are deprecated. Each of these deprecations can still be used but will produce a warning when the deprecation is first used. You can use the old interfaces without warnings by passing new() the flag use_deprecated. Example:

$parser = XML::XSLT->new($xsl, "FILE",
                         use_deprecated => 1);

The deprecated methods will disappear by the time a 1.0 release is made.

The deprecated methods are :

🐛 BUGS

Yes.

📜 HISTORY

Geert Josten and Egon Willighagen developed and maintained XML::XSLT up to version 0.22. At that point, Mark Hershberger started moving the project to Sourceforge and began working on it with Bron Gondwana.

📄 LICENCE

Copyright (c) 1999 Geert Josten & Egon Willighagen. All Rights Reserved. This module is free software, and may be distributed under the same terms and conditions as Perl.

👥 AUTHORS

🔗 SEE ALSO

XML::DOM, LWP::Simple, XML::Parser

XML::XSLT
📝 NAME 🚀 Quick Reference 📖 SYNOPSIS 📝 DESCRIPTION
📂 Specifying Sources 📚 METHODS
📋 XML::XSLT Commands 🆘 SUPPORT ⚠️ DEPRECATIONS 🐛 BUGS 📜 HISTORY 📄 LICENCE 👥 AUTHORS 🔗 SEE ALSO

Generated by phpman v4.10.0-7-g98e9fd5 · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-09-15 12:43 @216.73.216.74
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
Valid XHTML 1.0 Transitional!Valid CSS!

^_top_^