GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  XML::STX (3)

.ds Aq ’

NAME

XML::STX - a pure Perl STX processor

CONTENTS

SYNOPSIS



 use XML::STX;

 $stx = XML::STX->new();

 $transformer = $stx->new_transformer($stylesheet_uri);
 $transformer->transform($source_uri);



DESCRIPTION

XML::STX is a pure Perl implementation of STX processor. Streaming Transformations for XML (STX) is a one-pass transformation language for XML documents that builds on the Simple API for XML (SAX). See http://stx.sourceforge.net/ for more details.

Dependencies: XML::SAX, XML::NamespaceSupport and Clone.

The current version is unstable.

USAGE

    Shortcut TrAX-like API

Thanks to various shortcuts of the TrAX-like API, this is the simplest way to run transformations. This can be what you want if you are happy with just one transformation context per stylesheet, and your input data is in files. Otherwise, you may want to use some more features of this API (see Full TrAX-like API).



 use XML::STX;

 $stx = XML::STX->new();

 $transformer = $stx->new_transformer($stylesheet_uri);
 $transformer->transform($source_uri);



    Full TrAX-like API

This is the regular interface to XML::STX allowing to run independent transformations for single template, bind external parameters, and associate drivers/handlers with input/output channels.



 use XML::STX;

 $stx = XML::STX->new();

 $stylesheet = $stx->new_source($stylesheet_uri);
 $templates = $stx->new_templates($stylesheet);
 $transformer = $templates->new_transformer();

 $transformer->{Parameters} = {par1 => 5, par2 => foo};

 $source = $stx->new_source($source_uri);
 $result = $stx->new_result();

 $transformer->transform($source, $result);



    SAX Filter



 use XML::STX;
 use SAX2Parser;
 use SAX2Handler;

 $stx = XML::STX->new();
 $stx_parser = XML::STX::Parser->new();
 $xml_parser1 = SAX2Parser->new(Handler => $stx_parser);
 $stylesheet =  $xml_parser1->parse_uri($templ_uri);

 $writer = XML::SAX::Writer->new();
 $stx = XML::STX->new(Handler => $writer, Sheet => $stylesheet );
 $xml_parser2 = SAX2Parser->new(Handler => $stx);
 $xml_parser2->parse_uri($data_uri);



    Legacy API (deprecated)



 use XML::STX;

 $stx = XML::STX->new();
 $parser_t = SAX2Parser->new();
 $stylesheet = $stx->get_stylesheet($parser_t, $templ_uri);

 $parser = SAX2Parser->new();
 $handler = SAX2Handler->new();
 $stx->transform($stylesheet, $parser, $data_uri, $handler);



    Command-line Interface

XML::STX is shipped with <B>stxcmd.plB> script allowing to run STX transformations from the command line.

Usage:



 stxcmd.pl [OPTIONS] <stylesheet> <data> [PARAMS]



Run stxcmd.pl -h for more details.

AUTHOR

Petr Cimprich (Ginger Alliance), petr@gingerall.cz

SEE ALSO

XML::SAX, XML::NamespaceSupport, perl(1).
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 STX (3) 2004-12-22

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.