File: README

package info (click to toggle)
libxml-saxon-xslt2-perl 0.010-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 260 kB
  • sloc: perl: 339; makefile: 2; sh: 1
file content (141 lines) | stat: -rw-r--r-- 5,286 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
NAME
    XML::Saxon::XSLT2 - process XSLT 2.0 using Saxon 9.x.

SYNOPSIS
     use XML::Saxon::XSLT2;
 
     # make sure to open filehandle in right encoding
     open(my $input, '<:encoding(UTF-8)', 'path/to/xml') or die $!;
     open(my $xslt, '<:encoding(UTF-8)', 'path/to/xslt') or die $!;
 
     my $trans  = XML::Saxon::XSLT2->new($xslt, $baseurl);
     my $output = $trans->transform($input);
     print $output;
 
     my $output2 = $trans->transform_document($input);
     my @paragraphs = $output2->getElementsByTagName('p');

DESCRIPTION
    This module implements XSLT 1.0 and 2.0 using Saxon 9.x via Inline::Java.

    It expects Saxon to be installed in either '/usr/share/java/saxon9he.jar'
    or '/usr/local/share/java/saxon9he.jar'. Future versions should be more
    flexible. The saxon9he.jar file can be found at
    <http://saxon.sourceforge.net/> - just dowload the latest Java release of
    Saxon-HE 9.x, open the Zip archive, extract saxon9he.jar and save it to
    one of the two directories above.

  Import
     use XML::Saxon::XSLT2;

    You can include additional parameters which will be passed straight on to
    Inline::Java, like this:

     use XML::Saxon::XSLT2 EXTRA_JAVA_ARGS => '-Xmx256m';

    The `import` function *must* be called. If you load this module without
    importing it, it will not work. (Don't worry, it won't pollute your
    namespace.)

  Constructor
    `XML::Saxon::XSLT2->new($xslt, [$baseurl])`
        Creates a new transformation. $xslt may be a string, a file handle or
        an XML::LibXML::Document. $baseurl is an optional base URL for
        resolving relative URL references in, for instance, <xsl:import>
        links. Otherwise, the current directory is assumed to be the base.
        (For base URIs which are filesystem directories, remember to include
        the trailing slash.)

  Methods
    `$trans->parameters($key=>$value, $key2=>$value2, ...)`
        Sets transformation parameters prior to running the transformation.

        Each key is a parameter name.

        Each value is the parameter value. This may be a scalar, in which case
        it's treated as an xs:string; a DateTime object, which is treated as
        an xs:dateTime; a URI object, xs:anyURI; a Math::BigInt, xs:long; or
        an arrayref where the first element is the type and the second the
        value. For example:

         $trans->parameters(
            now             => DateTime->now,
            madrid_is_capital_of_spain => [ boolean => 1 ],
            price_of_fish   => [ decimal => '1.99' ],
            my_link         => URI->new('http://example.com/'),
            your_link       => [ uri => 'http://example.net/' ],
         );

        The following types are supported via the arrayref notation: float,
        double, long (alias int, integer), decimal, bool (alias boolean),
        string, qname, uri, date, datetime. These are case-insensitive.

    `$trans->transform($doc, [$output_method])`
        Run a transformation, returning the output as a string.

        $doc may be a string, a file handle or an XML::LibXML::Document.

        $output_method may be 'xml', 'xhtml', 'html' or 'text' to override the
        XSLT output method; or 'default' to use the output method specified in
        the XSLT file. 'default' is the default. In the current release,
        'default' is broken. :-(

    `$trans->transform_document($doc, [$output_method])`
        As per <transform>, but returns the output as an
        XML::LibXML::Document.

        This method is slower than `transform`.

    `$trans->messages`
        Returns a list of string representations of messages output by
        <xsl:message> during the last transformation run.

    `$trans->media_type($default)`
        Returns the output media type for the transformation.

        If the transformation doesn't specify an output type, returns the
        default.

    `$trans->doctype_public($default)`
        Returns the output DOCTYPE public identifier for the transformation.

        If the transformation doesn't specify a doctype, returns the default.

    `$trans->doctype_system($default)`
        Returns the output DOCTYPE system identifier for the transformation.

        If the transformation doesn't specify a doctype, returns the default.

    `$trans->version($default)`
        Returns the output XML version for the transformation.

        If the transformation doesn't specify a version, returns the default.

    `$trans->encoding($default)`
        Returns the output encoding for the transformation.

        If the transformation doesn't specify an encoding, returns the
        default.

BUGS
    Please report any bugs to <http://rt.cpan.org/>.

SEE ALSO
    XML::LibXSLT is probably more reliable in terms of easy installation on a
    variety of platforms, and it allows you to define your own XSLT extension
    functions. However, the libxslt library that it's based on only supports
    XSLT 1.0.

    This module uses Inline::Java.

    <http://saxon.sourceforge.net/>.

AUTHOR
    Toby Inkster <tobyink@cpan.org>.

COPYRIGHT
    Copyright 2010-2012, 2014 Toby Inkster

    This library is free software; you can redistribute it and/or modify it
    under the same terms as Perl itself.