Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

a Perl framework for XML stylesheets

README
XPathScript
===========

===== DESCRIPTION

This is the XML::XPathScript stylesheet framework, part of the AxKit
project at http://axkit.org/.

XPathScript is a stylesheet language similar in many ways to XSLT (in
concept, not in appearance), for transforming XML from one format to
another - possibly HTML, but XPathScript also shines for non-XML-like
output.

Like XSLT, XPathScript offers a dialect to mix verbatim portions of
documents and code. Also like XSLT, it leverages the powerful
``templates/apply-templates'' and ``cascading stylesheets'' design
patterns, that greatly simplify the design of stylesheets for
programmers. The availability of the XPath query language inside
stylesheets promotes the use of a purely document-dependent,
side-effect-free coding style. But unlike XSLT which uses its own
dedicated control language with an XML-compliant syntax, XPathScript
uses Perl which is terse and highly extendable.

The result of the merge is an extremely powerful tool for rendering
complex XML documents into other formats. Stylesheets written in
XPathScript are very easy to create, extend and reuse, even if they
manage hundreds of different XML tags.  As a testimony to these
qualities, XML::XPathScript comes bundled with a fairly comprehensive
stylesheet for converting Docbook XML into LaTeX (in the examples/
directory).

===== INSTALLATION

To install this module type the following:

   perl ./Build.PL
   ./Build
   ./Build test
   ./Build install

   or, if you are old-school,

   perl Makefile.PL
   make
   make test
   make install

   
During installation, Build.PL will check if it should use XML::LibXML 
or XML::XPath as the default xml parser. If you want to force XPathScript 
to use one or the other, do

	perl Build.PL -parser=XML::LibXML
	or
	perl Build.PL -parser=XML::XPath

If AxKit or TomKit are present, their respective XPathScript processors will
be automatically added to the installation. To force their installation
without the presence of AxKit/TomKit, do

    perl Build.PL -axkit -tomkit
	
===== COMMAND-LINE USE

This module provides an xpathscript(1) shell command that comes with
its own manpage.

===== SUPPORT FOR AXKIT

XPS comes with its AxKit language module. Not to clash with the 
Apache::AxKit::Language::XPathScript.pm bundled with AxKit, it is named
Apache::AxKit::Language::YPathScript.pm. To use this module under AxKit, 
add the following to your httpd.conf (the first two lines are probably 
already present):

	PerlModule AxKit
	AddHandler AxKit .xml
	AxAddStyleMap application/x-ypathscript Apache::AxKit::Language::YPathScript

And to your .htaccess something like:

	<AxStyleName "#default">
	   AxAddProcessor application/x-ypathscript your_stylesheet.xps
	</AxStyleName>


===== SUPPORT FOR TOMKIT

XPS also includes a TomKit processor, which will be installed if TomKit itself is 
detected. To use the processor, add something like the following to your .htaccess:

    PerlSetVar AxAddProcessorMap "text/xps=>Apache2::TomKit::Processor::XPathScript"
    
    <Files *\.xml>
        PerlFixupHandler Apache2::TomKit
        PerlSetVar AxAddProcessorDef "text/xps=>stylesheet.xps"
    </Files>
Something went wrong with that request. Please try again.