.\" Automatically generated by Pod::Man 4.10 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "XML::Saxon::XSLT2 3pm" .TH XML::Saxon::XSLT2 3pm "2018-12-01" "perl v5.28.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" XML::Saxon::XSLT2 \- process XSLT 2.0 using Saxon 9.x. .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use XML::Saxon::XSLT2; \& \& # make sure to open filehandle in right encoding \& open(my $input, \*(Aq<:encoding(UTF\-8)\*(Aq, \*(Aqpath/to/xml\*(Aq) or die $!; \& open(my $xslt, \*(Aq<:encoding(UTF\-8)\*(Aq, \*(Aqpath/to/xslt\*(Aq) 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(\*(Aqp\*(Aq); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This module implements \s-1XSLT 1.0\s0 and 2.0 using Saxon 9.x via Inline::Java. .PP 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 \- 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. .SS "Import" .IX Subsection "Import" .Vb 1 \& use XML::Saxon::XSLT2; .Ve .PP You can include additional parameters which will be passed straight on to Inline::Java, like this: .PP .Vb 1 \& use XML::Saxon::XSLT2 EXTRA_JAVA_ARGS => \*(Aq\-Xmx256m\*(Aq; .Ve .PP The \f(CW\*(C`import\*(C'\fR function \fImust\fR be called. If you load this module without importing it, it will not work. (Don't worry, it won't pollute your namespace.) .SS "Constructor" .IX Subsection "Constructor" .ie n .IP """XML::Saxon::XSLT2\->new($xslt, [$baseurl])""" 4 .el .IP "\f(CWXML::Saxon::XSLT2\->new($xslt, [$baseurl])\fR" 4 .IX Item "XML::Saxon::XSLT2->new($xslt, [$baseurl])" Creates a new transformation. \f(CW$xslt\fR may be a string, a file handle or an XML::LibXML::Document. \f(CW$baseurl\fR is an optional base \s-1URL\s0 for resolving relative \s-1URL\s0 references in, for instance, links. Otherwise, the current directory is assumed to be the base. (For base URIs which are filesystem directories, remember to include the trailing slash.) .SS "Methods" .IX Subsection "Methods" .ie n .IP """$trans\->parameters($key=>$value, $key2=>$value2, ...)""" 4 .el .IP "\f(CW$trans\->parameters($key=>$value, $key2=>$value2, ...)\fR" 4 .IX Item "$trans->parameters($key=>$value, $key2=>$value2, ...)" Sets transformation parameters prior to running the transformation. .Sp Each key is a parameter name. .Sp 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 \s-1URI\s0 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: .Sp .Vb 7 \& $trans\->parameters( \& now => DateTime\->now, \& madrid_is_capital_of_spain => [ boolean => 1 ], \& price_of_fish => [ decimal => \*(Aq1.99\*(Aq ], \& my_link => URI\->new(\*(Aqhttp://example.com/\*(Aq), \& your_link => [ uri => \*(Aqhttp://example.net/\*(Aq ], \& ); .Ve .Sp 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. .ie n .IP """$trans\->transform($doc, [$output_method])""" 4 .el .IP "\f(CW$trans\->transform($doc, [$output_method])\fR" 4 .IX Item "$trans->transform($doc, [$output_method])" Run a transformation, returning the output as a string. .Sp \&\f(CW$doc\fR may be a string, a file handle or an XML::LibXML::Document. .Sp \&\f(CW$output_method\fR may be 'xml', 'xhtml', 'html' or 'text' to override the \s-1XSLT\s0 output method; or 'default' to use the output method specified in the \s-1XSLT\s0 file. 'default' is the default. In the current release, \&'default' is broken. :\-( .ie n .IP """$trans\->transform_document($doc, [$output_method])""" 4 .el .IP "\f(CW$trans\->transform_document($doc, [$output_method])\fR" 4 .IX Item "$trans->transform_document($doc, [$output_method])" As per , but returns the output as an XML::LibXML::Document. .Sp This method is slower than \f(CW\*(C`transform\*(C'\fR. .ie n .IP """$trans\->messages""" 4 .el .IP "\f(CW$trans\->messages\fR" 4 .IX Item "$trans->messages" Returns a list of string representations of messages output by during the last transformation run. .ie n .IP """$trans\->media_type($default)""" 4 .el .IP "\f(CW$trans\->media_type($default)\fR" 4 .IX Item "$trans->media_type($default)" Returns the output media type for the transformation. .Sp If the transformation doesn't specify an output type, returns the default. .ie n .IP """$trans\->doctype_public($default)""" 4 .el .IP "\f(CW$trans\->doctype_public($default)\fR" 4 .IX Item "$trans->doctype_public($default)" Returns the output \s-1DOCTYPE\s0 public identifier for the transformation. .Sp If the transformation doesn't specify a doctype, returns the default. .ie n .IP """$trans\->doctype_system($default)""" 4 .el .IP "\f(CW$trans\->doctype_system($default)\fR" 4 .IX Item "$trans->doctype_system($default)" Returns the output \s-1DOCTYPE\s0 system identifier for the transformation. .Sp If the transformation doesn't specify a doctype, returns the default. .ie n .IP """$trans\->version($default)""" 4 .el .IP "\f(CW$trans\->version($default)\fR" 4 .IX Item "$trans->version($default)" Returns the output \s-1XML\s0 version for the transformation. .Sp If the transformation doesn't specify a version, returns the default. .ie n .IP """$trans\->encoding($default)""" 4 .el .IP "\f(CW$trans\->encoding($default)\fR" 4 .IX Item "$trans->encoding($default)" Returns the output encoding for the transformation. .Sp If the transformation doesn't specify an encoding, returns the default. .SH "BUGS" .IX Header "BUGS" Please report any bugs to . .SH "SEE ALSO" .IX Header "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 \s-1XSLT\s0 extension functions. However, the libxslt library that it's based on only supports \s-1XSLT 1.0.\s0 .PP This module uses Inline::Java. .PP . .SH "AUTHOR" .IX Header "AUTHOR" Toby Inkster . .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright 2010\-2012, 2014 Toby Inkster .PP This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.