The Perl Advent Calendar needs more articles for 2022. Submit your idea today!

NAME

XML::XSLT - A perl module for processing XSLT

SYNOPSIS

use XML::XSLT;

$XSLT::Parser->open_project ($xmlfile, $xslfile); $XSLT::Parser->process_project; $XSLT::Parser->print_result;

        The variables $xmlfile and $xslfile are filenames, e.g. "filename",
        or regular Perl filehandles, pass those with *FILEHANDLE.

# Alternatives for open_project()

$XSLT::Parser->open_project ($xmlstring, $xslstring, "STRING", "STRING");

        The variables $xmlstring and $xslstring are regular Perl scalars
        variables or references to these, pass the latter with \$string.

$XSLT::Parser->open_project ($xmldom, $xsldom, "DOM", "DOM");

        The variables $xmldom and $xsldom are XML::DOM trees. The Document Node
        should be passed here.

# String, file and DOM input can be intermingled

$XSLT::Parser->open_project ($xmlfile_or_handle, $xslstring_or_ref, "FILE", "STRING");

$XSLT::Parser->open_project ($xmlDOMtree, $xslfile_or_handle, "DOM", "FILE");

# Alternatives for print_result()

$XSLT::Parser->print_result($outputfile);

        The variable $outputfile is a filename, e.g. "filename" or a regular
        Perl filehandle. Pass the latter with *FILEHANDLE.

DESCRIPTION

This module implements the W3C's XSLT specification. The goal is full implementation of this spec, but it isn't yet. However, it already works well. Below is given the set of working xslt commands.

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

LICENCE

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.

XML::XSLT Commands

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 no

Not supported yet.

xsl:call-template yes

Takes attribute 'name' which selects xsl:template by name.

Not supported yet: - xsl:sort and xsl:with-param in content

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 experimental

It is implemented, but it does not appear in the result

xsl:copy partially

Not supported yet: - attribute 'use-attribute-sets'

xsl:copy-of limited

Attribute 'select' functions as well as with xsl:value-of

xsl:decimal-format no

Not supported yet.

xsl:element no

Not supported yet.

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

Supported.

xsl:output no

Not supported yet.

xsl:param no

Not supported yet.

xsl:preserve-space no

Not supported yet. Whitespace is always preserved.

xsl:processing-instruction yes

Supported.

xsl:sort no

Not supported yet.

xsl:strip-space no

Not supported yet. No whitespace is stripped.

xsl:stylesheet limited

Has to be present. None of the attributes supported yet.

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 partially

Not supported yet: - attribute 'disable-output-escaping'

xsl:transform no

Not supported yet.

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"/>

and combinations of these;

Not supported yet: - attribute 'disable-output-escaping'

xsl:variable no

Not supported yet.

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/elem">

<xsl:when test="path/@attr">

xsl:with-param no

Not supported yet.

SUPPORT

Support can be obtained from the XML::XSLT mailling list:

  http://xmlxslt.listbot.com/

General information, like bugs and current functionality, can be found at the XML::XSLT homepage:

  http://www.sci.kun.nl/sigma/Persoonlijk/egonw/xslt/