XML::XPathScript::Stylesheet is XPathScript's stylesheet writer guide.
STYLESHEET SYNTAX
An XPathScript stylesheet is written in an ASP-like format; everything that is not enclosed within special delimiters are printed verbatim.
Delimiters
< % % >
Evaluates the code enclosed without printing anything.
Example:
< % $template- >set( 'foo' = > { pre = > 'bar' } ); % >
< %= % >
Evaluates the code enclosed and prints out its result.
Example:
Author: < %= findvalue( '/doc/author@name' ) % >
< %# % >
Comments out the code enclosed. The code will not be executed, nor show in the transformed document.
< %~ % >
A shorthand for < %= apply_templates( ) % >
Example:
Author: < %~ /doc/author % >
< %@ % >
A simplified way to set up the content attribute of a tag. The code
< %@ foo
< h1 >< %= $title % >< /h1 >
< %~ bar % >
% >
is equivalent to
< %
$template- >set( foo = > { content < < 'END_CONTENT' } );
< h1 >< %= $title % >< /h1 >
< %~ bar % >
END_CONTENT
% >
< %- -% >, < %-= -% >, < %-~ -% >, < %-# -% >, < %-@ -% >
If a dash is added to a delimiter, all whitespaces (including carriage returns) predeceding or following the delimiter are removed from the transformed document. This is useful to keep a stylesheet readable without generating transformed document with many whitespace gaps. The dash can be added independently to the right and left delimiter.
Example:
< h1 >
< %-~ /doc/title -% >
< /h1 >
< !--#include file="/path/to/file" -- >
Insert the content of the file into the stylesheet. The path is relative to the stylesheet, not the processed document.
PRE-DEFINED VARIABLES
This section describes pre-defined variables accessible from within a XPathScript stylesheet.
$template, $t, $XML::XPathScript::trans
All three variables point to the stylesheet's template. See section "TRANSFORMATION TEMPLATE".
$XML::XPathScript::xp
The DOM of the xml document unto which the stylesheet is applied.
$XML::XPathScript::current
The XML::XPathScript object from which the stylesheet has been invoked. See the XML::XPathScript manpage for a list of utility methods that can be called from within the stylesheet.
Requirements:
· Perl
|