Taxi::Mysql::Format::XSLT - hit list formatter: XSL-transformed flat XML |
Taxi::Mysql::Format::XSLT - hit list formatter: XSL-transformed flat XML
##======================================================================== ## PRELIMINARIES
use Taxi::Mysql::Format::XSLT;
##======================================================================== ## Constructors etc.
$q = $CLASS_OR_OBJ->new(%args);
##======================================================================== ## Initialization / reset
$xslt = $fmt->newXslt();
##======================================================================== ## Stylesheet parsing
$stylesheet = $fmt->parseStyleString($string); $stylesheet = $fmt->parseStyleFile($filename); $stylesheet = $fmt->parseStyleFh($filehandle);
##======================================================================== ## Transformation
$stylesheet = $fmt->stylesheet($hitList); $results = $fmt->transform($hitList); \%params = $fmt->xsltParams($hitList);
##======================================================================== ## Output
$contentType = $fmt->contentType(); $str = $fmt->toString($hitList); undef = $fmt->toFile($hitList,$filename); undef = $fmt->toFh($hitList,$fh);
Taxi::Mysql::Format::XSLT is a class for formatting HitList objects via user-specified XSL transformation of an XML document containing a ``flat'' series of records.
Taxi::Mysql::Format::XML inherits from and implements the API specified by Taxi::Mysql::Format::XML. XSL transformation is applied after XML generation has succeeded.
Package-global variable holding the default XML::LibXML (parser) object used for parsing user-specified stylesheets.
$q = $CLASS_OR_OBJ->new(%args);
Object structre / %args:
{ ##-- Stylesheet data parser => $xml_parser, ##-- XML::LibXML::Parser object; default = $_parser xslt => $xslt, ##-- an XML::LibXSLT object; default = (new object) styledoc => $doc, ##-- an XML::LibXML::Document for the stylesheet (see parseStyle*() methods) stylesheet => $style, ##-- an XML::LibXSLT::Stylesheet object (parsed stylesheet) params => \%params, ##-- params for $style->transform()
##-- XML formatting (from ../XML) xmlVersion => $version, ##-- output XML version (default="1.0") xmlEncoding => $encoding, ##-- output XML encoding (default="UTF-8") xmlHitListElt => $listElt, ##-- element for whole HitList (root); default='hitlist' xmlHitElt => $hitElt, ##-- element for single hits; default='hit' xmlTokElt => $tokElt, ##-- element for single tokens; default='tok' xmlHitNAttr => $hitNAttr, ##-- hit-number attribute (default="n") pretty => $level, ##-- $format argument for XML::LibXML::Document->toXXX()
##-- Source data (from ../../Format) index => $index, ##-- underlying Taxi::Mysql object }
free()
Deletes parser, xslt object, and any parameters to avoid circular references.
$xslt = $CLASS_OR_OBJ->newXslt()
Returns default XML::LibXSLT object to be used for stylesheet parsing.
Method may be overridden by descendant classes,
e.g. to call $xslt->register_function()
for subclass-specific functions.
$stylesheet = $fmt->parseStyleString($string);
Parses stylesheet to use for transformation from a string.
$stylesheet = $fmt->parseStyleFile($filename);
Parses stylesheet to use for transformation from a named file.
$stylesheet = $fmt->parseStyleFh($filehandle);
Parses stylesheet to use for transformation from an open filehandle.
$stylesheet = $fmt->stylesheet($hitList);
Returns stylesheet (as an XML::LibXSLT::Stylesheet object?) to be used for transformation. May be re-implemented in descendant classes to generate stylesheet on-demand. Default implementation just returns $fmt->{stylesheet}.
$results = $fmt->transform($hitList);
Transforms the hitListDocument()
for $hitList by means of
the stylesheet $fmt->stylesheet($hitList)
and
the parameters returned by $fmt->xsltParams($hitList).
\%params = $fmt->xsltParams($hitList);
Should return parameters for XSL transformations. Default version just returns $fmt->{params}.
$contentType = $fmt->contentType();
Default version uses stylesheet()->media_type(). If no stylesheet is available, 'text/xml' is returned as a default.
$str = $fmt->toString($hitList);
undef = $fmt->toFile($hitList,$filename);
undef = $fmt->toFh($hitList,$fh);
Perl by Larry Wall.
Bryan Jurish <moocow@ling.uni-potsdam.de>
Copyright (C) 2006 by Bryan Jurish
This package is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.7 or, at your option, any later version of Perl 5 you may have available.
perl(1), Taxi::Mysql(3perl), Taxi::Mysql::Format(3perl), Taxi::Mysql::Format::XML(3perl), Taxi::Mysql::Format::XSLTBibl(3perl).
Taxi::Mysql::Format::XSLT - hit list formatter: XSL-transformed flat XML |