Any::Renderer::XSLT - render by XLST of XML element representation of data structure
use Any::Renderer; my %xml_options = (); my %options = ( 'XmlOptions' => \%xml_options, 'Template' => 'path/to/template.xslt', ); my $format = "XSLT"; my $r = new Any::Renderer ( $format, \%options ); my $data_structure = [...]; # arbitrary structure code my $string = $r->render ( $data_structure );
You can get a list of all formats that this module handles using the following syntax:
my $list_ref = Any::Renderer::XSLT::available_formats ();
Also, determine whether or not a format requires a template with requires_template:
my $bool = Any::Renderer::XSLT::requires_template ( $format );
Any::Renderer::XSLT renders a Perl data structure as an interstitial XML representation (via Any::Renderer::XML) and then proceeds to apply a XSLT transformation to it to generate the final output.
XSL Templates expressed as filenames are cached using a package-level in-memory cache with Cache::AgainstFile. This will stat the file to validate the cache before using the cached object, so if the template is updated, this will be immediately picked up by all processes holding a cached copy.
$format must be XSLT. See "OPTIONS" for a description of valid %options.
$format
XSLT
%options
The main method.
True in this case.
Just the one - XSLT.
A hash reference to options passed to XML::Simple::XMLout to control the generation of the interstitial XML. See XML::Simple for a detailed description of all of the available options.
Set the XML root element name in the interstitial XML. You can also achieve this by setting the RootName or rootname options passed to XML::Simple in the XML options hash. This is a shortcut to make this renderer behave like some of the other renderer backends.
RootName
rootname
XML
Filename of XSL template. Mandatory unless TemplateString is defined.
String containing XSL template. Mandatory unless Template or TemplateFilename is defined.
Disable in-memory caching of XSLTs loaded from the filesystem.
The package-level template cache is created on demand the first time it's needed. There are a few global variables which you can tune before it's created (i.e. before you create any objects):
Maximum number of template objects held in the cache. Default is 1000.
Items older than this will be purged from the cache when the next purge() call happens. In Seconds. Default is 6 hours.
How often to purge the cache. In Seconds. Default is 1 hour.
Any::Renderer::XML, Any::Renderer, Cache::AgainstFile
$Revision: 1.14 $ on $Date: 2006/09/04 12:15:53 $ by $Author: johna $
Matt Wilson and John Alden <cpan _at_ bbc _dot_ co _dot_ uk>
(c) BBC 2006. This program is free software; you can redistribute it and/or modify it under the GNU GPL.
See the file COPYING in this distribution, or http://www.gnu.org/licenses/gpl.txt
To install Any::Renderer, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Any::Renderer
CPAN shell
perl -MCPAN -e shell install Any::Renderer
For more information on module installation, please visit the detailed CPAN module installation guide.