BBC (British Broadcasting Corporation) > Any-Renderer-1.014 > Any::Renderer::XSLT

Download:
Any-Renderer-1.014.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  1
View/Report Bugs
Module Version: 1.014   Source   Latest Release: Any-Renderer-1.015_02

NAME ^

Any::Renderer::XSLT - render by XLST of XML element representation of data structure

SYNOPSIS ^

  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 );

DESCRIPTION ^

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.

FORMATS ^

XSLT

METHODS ^

$r = new Any::Renderer::XSLT($format,\%options)

$format must be XSLT. See "OPTIONS" for a description of valid %options.

$scalar = $r->render($data_structure)

The main method.

$bool = Any::Renderer::XSLT::requires_template($format)

True in this case.

$list_ref = Any::Renderer::XSLT::available_formats()

Just the one - XSLT.

OPTIONS ^

XmlOptions

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.

VariableName

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.

Template (aka TemplateFilename)

Filename of XSL template. Mandatory unless TemplateString is defined.

TemplateString

String containing XSL template. Mandatory unless Template or TemplateFilename is defined.

NoCache

Disable in-memory caching of XSLTs loaded from the filesystem.

GLOBAL VARIABLES ^

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):

$Any::Renderer::XSLT::CacheMaxItems

Maximum number of template objects held in the cache. Default is 1000.

$Any::Renderer::XSLT::CacheMaxAtime

Items older than this will be purged from the cache when the next purge() call happens. In Seconds. Default is 6 hours.

$Any::Renderer::XSLT::CachePurgeInterval

How often to purge the cache. In Seconds. Default is 1 hour.

SEE ALSO ^

Any::Renderer::XML, Any::Renderer, Cache::AgainstFile

VERSION ^

$Revision: 1.14 $ on $Date: 2006/09/04 12:15:53 $ by $Author: johna $

AUTHOR ^

Matt Wilson and John Alden <cpan _at_ bbc _dot_ co _dot_ uk>

COPYRIGHT ^

(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

syntax highlighting: