The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Plack::Middleware::XSLT - XSLT transformations with Plack

VERSION

version 0.30

SYNOPSIS

    # in your .psgi

    enable 'XSLT';

    # in your app

    $env->{'xslt.style'} = 'stylesheet.xsl';

    return [ 200, $headers, [ $xml ] ];

DESCRIPTION

Plack::Middleware::XSLT converts XML response bodies to HTML, XML, or text using XML::LibXSLT. The XSLT stylesheet is specified by the environment variable 'xslt.style'. If this variable is undefined or empty, the response is not altered. This rather crude mechanism might be enhanced in the future.

The Content-Type header is set according to xsl:output. Content-Length is adjusted.

CONFIGURATION

cache
    enable 'XSLT', cache => 1;

Enables caching of XSLT stylesheets. Defaults to false.

path
    enable 'XSLT', path => 'path/to/xsl/files';

Sets a path that will be prepended if xslt.style contains a relative path. Defaults to the current directory.

parser_options
    enable 'XSLT', parser_options => \%options;

Options that will be passed to the XML parser when parsing the input document. See "PARSER OPTIONS" in XML::LibXML::Parser.

CREATING HTTP ERRORS WITH XSL:MESSAGE

If the transform exits via <xsl:message terminate="yes"> and the message contains a line starting with a three-digit HTTP response status code and an optional message, a corresponding HTTP error response is created. For example:

    <xsl:message terminate="yes">404 Not found</xsl:message>

AUTHOR

Nick Wellnhofer <wellnhofer@aevum.de>

COPYRIGHT AND LICENSE

This software is copyright (c) 2014 by Nick Wellnhofer.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.