Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Contact Us
Online Help
Domain Status
Man Pages

Virtual Servers

Topology Map

Server Agreement
Year 2038

USA Flag



Man Pages
XML::XSLT(3) User Contributed Perl Documentation XML::XSLT(3)

XML::XSLT - A perl module for processing XSLT
Get or set the <xsl:output method= attribute. Valid arguments are 'html', 'text' and 'xml'

 use XML::XSLT;
 my $xslt = XML::XSLT->new ($xsl, warnings => 1);
 $xslt->transform ($xmlfile);
 print $xslt->toString;

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.

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.

new(Source => $xml [, %args])
Returns a new XSLT parser object. Valid flags are:
Hashref of arguments to pass to the XML::DOM::Parser object's parse method.
Hashref of variables and their values for the stylesheet.
Base of URL for file inclusion.
Turn on debugging messages.
Turn on warning messages.
Starting amount of indention for debug messages. Defaults to 0.
Amount to indent each level of debug message. Defaults to 1.
open_xml(Source => $xml [, %args])
Gives the XSLT object new XML to process. Returns an XML::DOM object corresponding to the XML.
The base URL to use for opening documents.
Arguments to pase to the parser.
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.
The base URL to use for opening documents.
Arguments to pase to the parser.
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 containg the result. Example:
  use XML::XSLT qw(serve);
  $xslt = XML::XSLT->new($xsl);
  print $xslt->serve $xml;
If true, then prepends the appropriate HTTP headers (e.g. Content-Type, Content-Length);
Defaults to true.
If true, then the result contains the appropriate <?xml?> header.
Defaults to true.
The version of the XML.
Defaults to 1.0.
The type of DOCTYPE this document is. Defaults to SYSTEM.
Returns the result of transforming the XML with the stylesheet as a string.
Returns the result of transforming the XML with the stylesheet as an XML::DOM object.
Returns the media type (aka mime type) of the object.
Executes the "dispose" method on each XML::DOM object.

xsl:apply-imports no
Not supported yet.
xsl:apply-templates limited
Attribute 'select' is supported to the same extent as xsl:value-of supports path selections.
Not supported yet: - attribute 'mode' - xsl:sort and xsl:with-param in content
xsl:attribute partially
Adds an attribute named to the value of the attribute 'name' and as value the stringified content-template.
Not supported yet: - attribute 'namespace'
xsl:attribute-set yes
xsl:call-template yes
Takes attribute 'name' which selects xsl:template's by name.
Weak support: - xsl:with-param (select attrib not supported)
Not supported yet: - xsl:sort
xsl:choose yes
Tests sequentially all xsl:whens until one succeeds or until an xsl:otherwise is found. Limited test support, see xsl:when
xsl:comment yes
xsl:copy partially
xsl:copy-of limited
Attribute 'select' functions as well as with xsl:value-of
xsl:decimal-format no
Not supported yet.
xsl:element yes
xsl:fallback no
Not supported yet.
xsl:for-each limited
Attribute 'select' functions as well as with xsl:value-of
Not supported yet: - xsl:sort in content
xsl:if limited
Identical to xsl:when, but outside xsl:choose context.
xsl:import no
Not supported yet.
xsl:include yes
Takes attribute href, which can be relative-local, absolute-local as well as an URL (preceded by identifier http:).
xsl:key no
Not supported yet.
xsl:message no
Not supported yet.
xsl:namespace-alias no
Not supported yet.
xsl:number no
Not supported yet.
xsl:otherwise yes
xsl:output limited
Only the initial xsl:output element is used. The "text" output method is not supported, but shouldn't be difficult to implement. Only the "doctype-public", "doctype-system", "omit-xml-declaration", "method", and "encoding" attributes have any support.
xsl:param experimental
Synonym for xsl:variable (currently). See xsl:variable for support.
xsl:preserve-space no
Not supported yet. Whitespace is always preserved.
xsl:processing-instruction yes
xsl:sort no
Not supported yet.
xsl:strip-space no
Not supported yet. No whitespace is stripped.
xsl:stylesheet limited
Minor namespace support: other namespace than 'xsl:' for xsl-commands is allowed if xmlns-attribute is present. xmlns URL is verified. Other attributes are ignored.
xsl:template limited
Attribute 'name' and 'match' are supported to minor extend. ('name' must match exactly and 'match' must match with full path or no path)
Not supported yet: - attributes 'priority' and 'mode'
xsl:text yes
xsl:transform limited
Synonym for xsl:stylesheet
xsl:value-of limited
Inserts attribute or element values. Limited support:
<xsl:value-of select="."/>
<xsl:value-of select="/root-elem"/>
<xsl:value-of select="elem"/>
<xsl:value-of select="//elem"/>
<xsl:value-of select="elem[n]"/>
<xsl:value-of select="//elem[n]"/>
<xsl:value-of select="@attr"/>
<xsl:value-of select=" text()"/>
<xsl:value-of select="processing- instruction()"/>
<xsl:value-of select=" comment()"/>
and combinations of these.
Not supported yet: - attribute 'disable-output-escaping'
xsl:variable partial or from literal text in the stylesheet.
xsl:when limited
Only inside xsl:choose. Limited test support:
<xsl:when test="@attr='value'">
<xsl:when test="elem='value'">
<xsl:when test="path/[@attr='value']">
<xsl:when test="path/[elem='value']">
<xsl:when test="path">
path is supported to the same extend as with xsl:value-of
xsl:with-param experimental
It is currently not functioning. (or is it?)

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

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 :
use toString instead
use toString instead
use toString instead
use toString instead
use media_type instead
use media_type instead
use to_dom instead
use to_dom instead
use transform instead
use process instead
use "Source" argument to new() and transform instead.
use serve() instead.


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.

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

Geert Josten <>
Egon Willighagen <>
Mark A. Hershberger <>
Bron Gondwana <>
Jonathan Stowe <>

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

Hey! The above document had some coding errors, which are explained below:
Around line 880:
'=item' outside of any '=over'
Around line 3581:
You forgot a '=back' before '=head1'
2004-02-20 perl v5.28.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.