Apache::AxKit::Language::YPathScript

Sub-class of Apache::AxKit::Language and XML::XPathScript.

global variables

$VERSION

$stash - Hash table of stylesheets

Imported modules

Apache
Apache::File
XML::XPath 1.00
XML::XPath::XMLParser
XML::XPath::Node
XML::XPath::NodeSet
XML::Parser
Apache::AxKit::Provider
Apache::AxKit::Language
Apache::AxKit::Cache
Apache::AxKit::Exception
Apache::AxKit::CharsetConv
X::X::Toys

Functions

$xps = new Apache::AxKit::Language::YPathScript($xml_provider, $style_provider)

Constructs a new YPathScript language interpreter out of the provided providers.

$rc = handler( $class, $request, $xml_provider, $style_provider )
The function called by Apache. Does all cache-managing magic.
Not present in X::X.
$file_content = include_file( $print_form, $filename )
$file_content = include_file( $print_form, $filename, @includestack )

Overloaded from XML::XPathScript in order to provide URI-based stylesheet inclusions: $filename may now be any AxKit URI. The AxKit language class drops support for plain filenames that exists in the ancestor class: this means that include directives like

<!-- #include file="/some/where.xps" -->

in existing stylesheets should be turned into

<!-- #include file="file:///some/where.xps" -->

in order to work with AxKit.

$doc = get_source_tree( $xml_provider )
Reads an XML document from the provider.
Return the doc as a string.

Not present in X::X
extract( $stylesheet, $printform )
extract( $stylesheet, $printform, $filename )
extract( $stylesheet, $printform, @includestack)

Overrides the X::YPS method

The embedded dialect parser. Given $stylesheet, which is a provider, returns a string that holds all the code in real Perl. Unquoted text and <%= stuff %> constructs in the stylesheet dialect is converted into invocations of $printform, which must be a function-like Perl form ( ``print'' by default), while <% stuff %> are transcripted verbatim.

<!-- #include --> constructs are expanded by passing their filename argument to "include_file" along with @includestack (if any) like this:

$self->include_file($includefilename,@includestack);

@includestack is not interpreted by extract() (except for the first entry, to create line tags for the debugger). It is only a bandaid for include_file() to pass the inclusion stack to itself across the mutual recursion existing between the two methods (see "include_file"). If extract() is invoked from outside include_file(), @includestack should be either empty or of size one.

This method does a purely syntactic job. No special framework declaration is prepended for isolating the code in its own package, defining $t or the like ("compile" does that). It may be overriden in subclasses to provide different escape forms in the stylesheet dialect.

$self->debug( $level, $message )

Prints $message if the requested debug level is equal or smaller than $level.

$self->die( $suicide_note )
$compiled_package = $self->get_stylesheet( $stylesheet_provider )
check_inc_mtime( $mtime, $provider, \@includes )
Check the modified time of included files

Use Apache::Axkit::Provider

Return 0 if recompile is required, 1 otherwise (?)

Not in X::X.
compile( $package, $provider )

Compile the XPS stylesheet given in $provider into the package $package and wrap it in the function &handler of that package.

Pretty much the same as for X::X

sub compile { my ($self, $package, $provider) = @_;

$self->debug( 5, 'Compiling package...' );

my $script = $self->extract($provider);

my $eval = join('',
        'package ',
        $package,
        '; use Apache qw(exit);',
        'use XML::XPath::Node;',
        'Apache::AxKit::Language::YPathScript::Toys->import;',
        'sub handler {',
        'my ($r, $xp, $t) = @_;',
        "\n#line 1 " . $provider->key() . "\n",
        $script,
        ";\n",
        'return Apache::Constants::OK;',
        "\n}",
        );

local $^W;

AxKit::Debug(10, "Compiling script:\n$eval\n");
eval $eval;
if ($@) {
    AxKit::Debug(1, "Compilation failed: $@");
    throw $@;
}
}
$file_content = include_file( $filename, $provider, $scalar_output )

Wrapper around extract. Verify if $filename hasn't already been extracted before.

Exists in X::X in a simplified version.

$nodeset = XML::XPath::Function::document( $node, $uri )
Reads XML given in $uri, parses it and returns it in a nodeset.

Pretty similar to the one in X::X, except for details like inclusion
of scheme axkit://.
$mtime = get_mtime( $class, $provider )

Returns the mtime of $provider.

$class is not used.

The global $stash is modified as a side-effect.

Does not exist in X::X.

NAME

Apache::AxKit::Language::YPathScript - An XML Stylesheet Language

SYNOPSIS

AxAddStyleMap "application/x-xpathscript => \
      Apache::AxKit::Language::YPathScript"

DESCRIPTION

This documentation has been removed. The definitive reference for XPathScript is now at http://axkit.org/docs/xpathscript/guide.dkb in DocBook format.

2 POD Errors

The following errors were encountered while parsing the POD:

Around line 67:

'=item' outside of any '=over'

Around line 648:

You forgot a '=back' before '=head1'