Plack::Middleware::XSLT - XSLT transformations with Plack
version 0.30
# in your .psgi enable 'XSLT'; # in your app $env->{'xslt.style'} = 'stylesheet.xsl'; return [ 200, $headers, [ $xml ] ];
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.
enable 'XSLT', cache => 1;
Enables caching of XSLT stylesheets. Defaults to false.
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.
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.
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"
<xsl:message terminate="yes">404 Not found</xsl:message>
Nick Wellnhofer <wellnhofer@aevum.de>
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.
To install Plack::Middleware::XSLT, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Plack::Middleware::XSLT
CPAN shell
perl -MCPAN -e shell install Plack::Middleware::XSLT
For more information on module installation, please visit the detailed CPAN module installation guide.