XML::XPathScript::Processor 0.14 review
DownloadXML::XPathScript::Processor is the XML transformation engine in XML::XPathScript. SYNOPSIS In a stylesheet ->{testcode} sub for
|
|
XML::XPathScript::Processor is the XML transformation engine in XML::XPathScript.
SYNOPSIS
In a stylesheet ->{testcode} sub for e.g. Docbook's < ulink > tag:
my $url = findvalue('@url',$self);
if (findnodes("node()", $self)) {
# ...
$t->{pre}=qq'< a href="$url" >';
$t->{post}=qq'< /a >';
return DO_SELF_AND_KIDS;
} else {
$t->{pre}=qq'< a href="$url" >$url< /a >';
$t->{post}=qq'';
return DO_SELF_ONLY;
};
At the stylesheet's top-level one often finds:
< %= apply_templates() % >
The XML::XPathScript distribution offers an XML parser glue, an embedded stylesheet language, and a way of processing an XML document into a text output. This package implements the latter part: it takes an already filled out $t template hash and an already parsed XML document (which come from XML::XPathScript behind the scenes), and provides a simple API to implement stylesheets. In particular, the "apply_templates" function triggers the recursive expansion of the whole XML document when used as shown in "SYNOPSIS".
Requirements:
Perl
What's New in This Release:
XML::XPathScript->current()->binmode() for non-UTF8 output
Renamed XML::XPathScript::Toys to XML::XPathScript::Processor
Introduction of testcode return value DO_TEXT_AS_CHILD for text nodes (see XML::XPathScript::Processor docs)
Interpolation regex is now configurable
Corrected Makefile.PL typo for XML::LibXML
General bug and typo fixes
XML::XPathScript::Processor 0.14 search tags