CONTRIBUTING000664001750001750 614612410225513 14545 0ustar00taitai000000000000XML-Saxon-XSLT2-0.010NAME CONTRIBUTING DESCRIPTION If you're reading this document, that means you might be thinking about helping me out with this project. Thanks! Here's some ways you could help out: * Bug reports Found a bug? Great! (Well, not so great I suppose.) The place to report them is . Don't e-mail me about it, as your e-mail is more than likely to get lost amongst the spam. An example script clearly demonstrating the bug (preferably written using Test::More) would be greatly appreciated. * Patches If you've found a bug and written a fix for it, even better! Generally speaking you should check out the latest copy of the code from the source repository rather than using the CPAN distribution. The file META.yml should contain a link to the source repository. If not, then try or submit a bug report. (As far as I'm concerned the lack of a link is a bug.) Many of my distributions are also mirrored at . To submit the patch, do a pull request on GitHub or Bitbucket, or attach a diff file to a bug report. Unless otherwise stated, I'll assume that your contributions are licensed under the same terms as the rest of the project. (If using git, feel free to work in a branch. For Mercurial, I'd prefer bookmarks within the default branch.) * Documentation If there's anything unclear in the documentation, please submit this as a bug report or patch as above. Non-toy example scripts that I can bundle would also be appreciated. * Translation Translations of documentation would be welcome. For translations of error messages and other strings embedded in the code, check with me first. Sometimes the English strings may not in a stable state, so it would be a waste of time translating them. Coding Style I tend to write using something approximating the Allman style, using tabs for indentation and Unix-style line breaks. * * I nominally encode all source files as UTF-8, though in practice most of them use a 7-bit-safe ASCII-compatible subset of UTF-8. AUTHOR Toby Inkster . COPYRIGHT AND LICENCE Copyright (c) 2012-2014 by Toby Inkster. CONTRIBUTING is available under three different licences permitting its redistribution: the CC-BY-SA_UK-2.0 licence, plus the same licences as Perl itself, which is distributed under the GNU General Public Licence version 1, and the Artistic Licence. This file is licensed under the Creative Commons Attribution-ShareAlike 2.0 UK: England & Wales License. To view a copy of this license, visit . This file is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. COPYRIGHT000664001750001750 177312410225513 14207 0ustar00taitai000000000000XML-Saxon-XSLT2-0.010Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: XML-Saxon-XSLT2 Upstream-Contact: TOBYINK and Toby Inkster Source: https://metacpan.org/release/XML-Saxon-XSLT2 Files: Changes META.json META.yml dist.ini doap.ttl t/01basic.t Copyright: Copyright 2014 Toby Inkster. License: GPL-1.0+ or Artistic-1.0 Files: CONTRIBUTING INSTALL LICENSE Makefile.PL Copyright: Unknown License: Unknown Files: COPYRIGHT CREDITS SIGNATURE Copyright: None License: public-domain Files: README lib/XML/Saxon/XSLT2.pm Copyright: Copyright 2010-2012, 2014 Toby Inkster. License: GPL-1.0+ or Artistic-1.0 License: Artistic-1.0 This software is Copyright (c) 2014 by the copyright holder(s). This is free software, licensed under: The Artistic License 1.0 License: GPL-1.0 This software is Copyright (c) 2014 by the copyright holder(s). This is free software, licensed under: The GNU General Public License, Version 1, February 1989 CREDITS000664001750001750 24312410225505 13704 0ustar00taitai000000000000XML-Saxon-XSLT2-0.010Maintainer: - TOBYINK - Toby Inkster Contributor: - TOBYINK Thanks: - - SREZIC Changes000664001750001750 311612410225505 14201 0ustar00taitai000000000000XML-Saxon-XSLT2-0.010XML-Saxon-XSLT2 =============== Created: 2010-07-14 Home page: Bug tracker: Maintainer: Toby Inkster 0.010 2014-09-23 - Add `/usr/local/share/java/classes/saxon9he.jar` to Makefile.PL too. 0.009 2014-09-15 - Add `/usr/local/share/java/classes/saxon9he.jar` to the list of paths where Saxon may be found. SREZIC++ 0.008 2014-09-10 [ Packaging ] - Switch to Dist::Inkt. 0.007 2012-09-11 Shaken, not stirred [ Documentation ] - Improve documentation of base URIs. Fixes RT#79463. - Improve documentation of import function. [ Packaging ] - Drop common::sense dependency. 0.006 2011-10-06 [ Documentation ] - Mention that the 'default' value for the output format of the 'transform' method is broken. [ Packaging ] - Upgrade Module::Package::RDF version. 0.005 2011-10-03 [ Bug Fixes ] - Change how $classpath is constructed. Fixes #66276. 0.004 2011-02-18 - Added: Allow parameters to be passed through to Inline::Java from the 'use' line. 0.003 2010-07-19 - Added: Can determine media-type, doctype-public, doctype-system, encoding and version attributes. 0.002 2010-07-15 - Added: Can capture output from . - Added: Can specify a base URI in the constructor. - No longer default to 'xml' output method, but respect XSLT's specified output method. 0.001 2010-07-15 Original version INSTALL000664001750001750 171412410225503 13737 0ustar00taitai000000000000XML-Saxon-XSLT2-0.010 Installing XML-Saxon-XSLT2 should be straightforward. INSTALLATION WITH CPANMINUS If you have cpanm, you only need one line: % cpanm XML::Saxon::XSLT2 If you are installing into a system-wide directory, you may need to pass the "-S" flag to cpanm, which uses sudo to install the module: % cpanm -S XML::Saxon::XSLT2 INSTALLATION WITH THE CPAN SHELL Alternatively, if your CPAN shell is set up, you should just be able to do: % cpan XML::Saxon::XSLT2 MANUAL INSTALLATION As a last resort, you can manually install it. Download the tarball and unpack it. Consult the file META.json for a list of pre-requisites. Install these first. To build XML-Saxon-XSLT2: % perl Makefile.PL % make && make test Then install it: % make install If you are installing into a system-wide directory, you may need to run: % sudo make install LICENSE000664001750001750 4365512410225503 13745 0ustar00taitai000000000000XML-Saxon-XSLT2-0.010This software is copyright (c) 2014 by Toby Inkster. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Terms of the Perl programming language system itself a) the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version, or b) the "Artistic License" --- The GNU General Public License, Version 1, February 1989 --- This software is Copyright (c) 2014 by Toby Inkster. This is free software, licensed under: The GNU General Public License, Version 1, February 1989 GNU GENERAL PUBLIC LICENSE Version 1, February 1989 Copyright (C) 1989 Free Software Foundation, Inc. 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The license agreements of most software companies try to keep users at the mercy of those companies. By contrast, our General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. The General Public License applies to the Free Software Foundation's software and to any other program whose authors commit to using it. You can use it for your programs, too. When we speak of free software, we are referring to freedom, not price. Specifically, the General Public License is designed to make sure that you have the freedom to give away or sell copies of free software, that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of a such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must tell them their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any work containing the Program or a portion of it, either verbatim or with modifications. Each licensee is addressed as "you". 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this General Public License and to the absence of any warranty; and give any other recipients of the Program a copy of this General Public License along with the Program. You may charge a fee for the physical act of transferring a copy. 2. You may modify your copy or copies of the Program or any portion of it, and copy and distribute such modifications under the terms of Paragraph 1 above, provided that you also do the following: a) cause the modified files to carry prominent notices stating that you changed the files and the date of any change; and b) cause the whole of any work that you distribute or publish, that in whole or in part contains the Program or any part thereof, either with or without modifications, to be licensed at no charge to all third parties under the terms of this General Public License (except that you may choose to grant warranty protection to some or all third parties, at your option). c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the simplest and most usual way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this General Public License. d) You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. Mere aggregation of another independent work with the Program (or its derivative) on a volume of a storage or distribution medium does not bring the other work under the scope of these terms. 3. You may copy and distribute the Program (or a portion or derivative of it, under Paragraph 2) in object code or executable form under the terms of Paragraphs 1 and 2 above provided that you also do one of the following: a) accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Paragraphs 1 and 2 above; or, b) accompany it with a written offer, valid for at least three years, to give any third party free (except for a nominal charge for the cost of distribution) a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Paragraphs 1 and 2 above; or, c) accompany it with the information you received as to where the corresponding source code may be obtained. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form alone.) Source code for a work means the preferred form of the work for making modifications to it. For an executable file, complete source code means all the source code for all modules it contains; but, as a special exception, it need not include source code for modules which are standard libraries that accompany the operating system on which the executable file runs, or for standard header files or definitions files that accompany that operating system. 4. You may not copy, modify, sublicense, distribute or transfer the Program except as expressly provided under this General Public License. Any attempt otherwise to copy, modify, sublicense, distribute or transfer the Program is void, and will automatically terminate your rights to use the Program under this License. However, parties who have received copies, or rights to use copies, from you under this General Public License will not have their licenses terminated so long as such parties remain in full compliance. 5. By copying, distributing or modifying the Program (or any work based on the Program) you indicate your acceptance of this license to do so, and all its terms and conditions. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. 7. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of the license which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the license, you may choose any version ever published by the Free Software Foundation. 8. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to humanity, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19xx name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (a program to direct compilers to make passes at assemblers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice That's all there is to it! --- The Artistic License 1.0 --- This software is Copyright (c) 2014 by Toby Inkster. This is free software, licensed under: The Artistic License 1.0 The Artistic License Preamble The intent of this document is to state the conditions under which a Package may be copied, such that the Copyright Holder maintains some semblance of artistic control over the development of the package, while giving the users of the package the right to use and distribute the Package in a more-or-less customary fashion, plus the right to make reasonable modifications. Definitions: - "Package" refers to the collection of files distributed by the Copyright Holder, and derivatives of that collection of files created through textual modification. - "Standard Version" refers to such a Package if it has not been modified, or has been modified in accordance with the wishes of the Copyright Holder. - "Copyright Holder" is whoever is named in the copyright or copyrights for the package. - "You" is you, if you're thinking about copying or distributing this Package. - "Reasonable copying fee" is whatever you can justify on the basis of media cost, duplication charges, time of people involved, and so on. (You will not be required to justify it to the Copyright Holder, but only to the computing community at large as a market that must bear the fee.) - "Freely Available" means that no fee is charged for the item itself, though there may be fees involved in handling the item. It also means that recipients of the item may redistribute it under the same conditions they received it. 1. You may make and give away verbatim copies of the source form of the Standard Version of this Package without restriction, provided that you duplicate all of the original copyright notices and associated disclaimers. 2. You may apply bug fixes, portability fixes and other modifications derived from the Public Domain or from the Copyright Holder. A Package modified in such a way shall still be considered the Standard Version. 3. You may otherwise modify your copy of this Package in any way, provided that you insert a prominent notice in each changed file stating how and when you changed that file, and provided that you do at least ONE of the following: a) place your modifications in the Public Domain or otherwise make them Freely Available, such as by posting said modifications to Usenet or an equivalent medium, or placing the modifications on a major archive site such as ftp.uu.net, or by allowing the Copyright Holder to include your modifications in the Standard Version of the Package. b) use the modified Package only within your corporation or organization. c) rename any non-standard executables so the names do not conflict with standard executables, which must also be provided, and provide a separate manual page for each non-standard executable that clearly documents how it differs from the Standard Version. d) make other distribution arrangements with the Copyright Holder. 4. You may distribute the programs of this Package in object code or executable form, provided that you do at least ONE of the following: a) distribute a Standard Version of the executables and library files, together with instructions (in the manual page or equivalent) on where to get the Standard Version. b) accompany the distribution with the machine-readable source of the Package with your modifications. c) accompany any non-standard executables with their corresponding Standard Version executables, giving the non-standard executables non-standard names, and clearly documenting the differences in manual pages (or equivalent), together with instructions on where to get the Standard Version. d) make other distribution arrangements with the Copyright Holder. 5. You may charge a reasonable copying fee for any distribution of this Package. You may charge any fee you choose for support of this Package. You may not charge a fee for this Package itself. However, you may distribute this Package in aggregate with other (possibly commercial) programs as part of a larger (possibly commercial) software distribution provided that you do not advertise this Package as a product of your own. 6. The scripts and library files supplied as input to or produced as output from the programs of this Package do not automatically fall under the copyright of this Package, but belong to whomever generated them, and may be sold commercially, and may be aggregated with this Package. 7. C or perl subroutines supplied by you and linked into this Package shall not be considered part of this Package. 8. The name of the Copyright Holder may not be used to endorse or promote products derived from this software without specific prior written permission. 9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. The End MANIFEST000664001750001750 24512410225513 14016 0ustar00taitai000000000000XML-Saxon-XSLT2-0.010CONTRIBUTING COPYRIGHT CREDITS Changes INSTALL LICENSE MANIFEST META.json META.yml Makefile.PL README SIGNATURE dist.ini doap.ttl lib/XML/Saxon/XSLT2.pm t/01basic.t META.json000664001750001750 353212410225512 14327 0ustar00taitai000000000000XML-Saxon-XSLT2-0.010{ "abstract" : "process XSLT 2.0 using Saxon 9.x", "author" : [ "Toby Inkster ", "TOBYINK " ], "dynamic_config" : 1, "generated_by" : "Dist::Inkt::Profile::TOBYINK version 0.023, CPAN::Meta::Converter version 2.140640", "keywords" : [ "Java", "XSL transformations", "XSLT" ], "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "XML-Saxon-XSLT2", "no_index" : { "directory" : [ "eg", "examples", "inc", "t", "xt" ] }, "optional_features" : {}, "prereqs" : { "configure" : { "requires" : { "ExtUtils::MakeMaker" : "6.17" } }, "runtime" : { "requires" : { "Inline::Java" : "0", "XML::LibXML" : "1.60", "perl" : "5.008000" } }, "test" : { "requires" : { "Test::More" : "0.61" } } }, "provides" : { "XML::Saxon::XSLT2" : { "file" : "lib/XML/Saxon/XSLT2.pm", "version" : "0.010" } }, "release_status" : "stable", "resources" : { "bugtracker" : { "web" : "http://rt.cpan.org/Dist/Display.html?Queue=XML-Saxon-XSLT2" }, "homepage" : "https://metacpan.org/release/XML-Saxon-XSLT2", "license" : [ "http://dev.perl.org/licenses/" ], "repository" : { "type" : "git", "url" : "git://github.com/tobyink/p5-xml-saxon-xslt2.git", "web" : "https://github.com/tobyink/p5-xml-saxon-xslt2" }, "x_identifier" : "http://purl.org/NET/cpan-uri/dist/XML-Saxon-XSLT2/project" }, "version" : "0.010", "x_contributors" : [ "TOBYINK" ] } META.yml000664001750001750 214612410225512 14157 0ustar00taitai000000000000XML-Saxon-XSLT2-0.010--- abstract: 'process XSLT 2.0 using Saxon 9.x' author: - 'Toby Inkster ' - 'TOBYINK ' build_requires: Test::More: '0.61' configure_requires: ExtUtils::MakeMaker: '6.17' dynamic_config: 1 generated_by: 'Dist::Inkt::Profile::TOBYINK version 0.023, CPAN::Meta::Converter version 2.140640' keywords: - Java - 'XSL transformations' - XSLT license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: XML-Saxon-XSLT2 no_index: directory: - eg - examples - inc - t - xt optional_features: {} provides: XML::Saxon::XSLT2: file: lib/XML/Saxon/XSLT2.pm version: '0.010' requires: Inline::Java: '0' XML::LibXML: '1.60' perl: '5.008000' resources: Identifier: http://purl.org/NET/cpan-uri/dist/XML-Saxon-XSLT2/project bugtracker: http://rt.cpan.org/Dist/Display.html?Queue=XML-Saxon-XSLT2 homepage: https://metacpan.org/release/XML-Saxon-XSLT2 license: http://dev.perl.org/licenses/ repository: git://github.com/tobyink/p5-xml-saxon-xslt2.git version: '0.010' x_contributors: - TOBYINK Makefile.PL000664001750001750 1247212410225512 14703 0ustar00taitai000000000000XML-Saxon-XSLT2-0.010use strict; use ExtUtils::MakeMaker 6.17; my $EUMM = eval( $ExtUtils::MakeMaker::VERSION ); my $meta = { "abstract" => "process XSLT 2.0 using Saxon 9.x", "author" => [ "Toby Inkster ", "TOBYINK ", ], "dynamic_config" => 1, "generated_by" => "Dist::Inkt::Profile::TOBYINK version 0.023, CPAN::Meta::Converter version 2.140640", "keywords" => ["Java", "XSL transformations", "XSLT"], "license" => ["perl_5"], "meta-spec" => { url => "http://search.cpan.org/perldoc?CPAN::Meta::Spec", version => 2, }, "name" => "XML-Saxon-XSLT2", "no_index" => { directory => ["eg", "examples", "inc", "t", "xt"] }, "prereqs" => { configure => { requires => { "ExtUtils::MakeMaker" => 6.17 } }, runtime => { requires => { "Inline::Java" => 0, "perl" => "5.008000", "XML::LibXML" => "1.60" }, }, test => { requires => { "Test::More" => 0.61 } }, }, "provides" => { "XML::Saxon::XSLT2" => { file => "lib/XML/Saxon/XSLT2.pm", version => "0.010" }, }, "release_status" => "stable", "resources" => { bugtracker => { web => "http://rt.cpan.org/Dist/Display.html?Queue=XML-Saxon-XSLT2", }, homepage => "https://metacpan.org/release/XML-Saxon-XSLT2", license => ["http://dev.perl.org/licenses/"], repository => { type => "git", url => "git://github.com/tobyink/p5-xml-saxon-xslt2.git", web => "https://github.com/tobyink/p5-xml-saxon-xslt2", }, x_identifier => "http://purl.org/NET/cpan-uri/dist/XML-Saxon-XSLT2/project", }, "version" => "0.010", "x_contributors" => ["TOBYINK"], }; my %dynamic_config; do { unless (-e '/usr/share/java/saxon9he.jar' or -e '/usr/local/share/java/saxon9he.jar' or -e '/usr/share/java/saxonb.jar' or -e '/usr/local/share/java/saxonb.jar' or -e '/usr/local/share/java/classes/saxon9he.jar') { warn "Need saxon9he.jar or saxonb.jar to be installed in /usr/share/java or /usr/local/share/java or /usr/local/share/java/classes."; exit 0; } }; my %WriteMakefileArgs = ( ABSTRACT => $meta->{abstract}, AUTHOR => ($EUMM >= 6.5702 ? $meta->{author} : $meta->{author}[0]), DISTNAME => $meta->{name}, VERSION => $meta->{version}, EXE_FILES => [ map $_->{file}, values %{ $meta->{x_provides_scripts} || {} } ], NAME => do { my $n = $meta->{name}; $n =~ s/-/::/g; $n }, test => { TESTS => "t/*.t" }, %dynamic_config, ); $WriteMakefileArgs{LICENSE} = $meta->{license}[0] if $EUMM >= 6.3001; sub deps { my %r; for my $stage (@_) { for my $dep (keys %{$meta->{prereqs}{$stage}{requires}}) { next if $dep eq 'perl'; my $ver = $meta->{prereqs}{$stage}{requires}{$dep}; $r{$dep} = $ver if !exists($r{$dep}) || $ver >= $r{$dep}; } } \%r; } my ($build_requires, $configure_requires, $runtime_requires, $test_requires); if ($EUMM >= 6.6303) { $WriteMakefileArgs{BUILD_REQUIRES} ||= deps('build'); $WriteMakefileArgs{CONFIGURE_REQUIRES} ||= deps('configure'); $WriteMakefileArgs{TEST_REQUIRES} ||= deps('test'); $WriteMakefileArgs{PREREQ_PM} ||= deps('runtime'); } elsif ($EUMM >= 6.5503) { $WriteMakefileArgs{BUILD_REQUIRES} ||= deps('build', 'test'); $WriteMakefileArgs{CONFIGURE_REQUIRES} ||= deps('configure'); $WriteMakefileArgs{PREREQ_PM} ||= deps('runtime'); } elsif ($EUMM >= 6.52) { $WriteMakefileArgs{CONFIGURE_REQUIRES} ||= deps('configure'); $WriteMakefileArgs{PREREQ_PM} ||= deps('runtime', 'build', 'test'); } else { $WriteMakefileArgs{PREREQ_PM} ||= deps('configure', 'build', 'test', 'runtime'); } { my ($minperl) = reverse sort( grep defined && /^[0-9]+(\.[0-9]+)?$/, map $meta->{prereqs}{$_}{requires}{perl}, qw( configure build runtime ) ); if (defined($minperl)) { die "Installing $meta->{name} requires Perl >= $minperl" unless $] >= $minperl; $WriteMakefileArgs{MIN_PERL_VERSION} ||= $minperl if $EUMM >= 6.48; } } sub FixMakefile { return unless -d 'inc'; my $file = shift; local *MAKEFILE; open MAKEFILE, "< $file" or die "FixMakefile: Couldn't open $file: $!; bailing out"; my $makefile = do { local $/; }; close MAKEFILE or die $!; $makefile =~ s/\b(test_harness\(\$\(TEST_VERBOSE\), )/$1'inc', /; $makefile =~ s/( -I\$\(INST_ARCHLIB\))/ -Iinc$1/g; $makefile =~ s/( "-I\$\(INST_LIB\)")/ "-Iinc"$1/g; $makefile =~ s/^(FULLPERL = .*)/$1 "-Iinc"/m; $makefile =~ s/^(PERL = .*)/$1 "-Iinc"/m; open MAKEFILE, "> $file" or die "FixMakefile: Couldn't open $file: $!; bailing out"; print MAKEFILE $makefile or die $!; close MAKEFILE or die $!; } my $mm = WriteMakefile(%WriteMakefileArgs); FixMakefile($mm->{FIRST_MAKEFILE} || 'Makefile'); exit(0); README000664001750001750 1224612410225503 13610 0ustar00taitai000000000000XML-Saxon-XSLT2-0.010NAME 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 - 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, 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 , 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 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 . 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. . AUTHOR Toby Inkster . 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. SIGNATURE000664001750001750 303012410225522 14164 0ustar00taitai000000000000XML-Saxon-XSLT2-0.010This file contains message digests of all files listed in MANIFEST, signed via the Module::Signature module, version 0.73. To verify the content in this distribution, first make sure you have Module::Signature installed, then type: % cpansign -v It will check each file's integrity, as well as the signature's validity. If "==> Signature verified OK! <==" is not displayed, the distribution may already have been compromised, and you should not run its Makefile.PL or Build.PL. -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 SHA1 33317486c4fa2cf7fec85bf92ed38ac0f64233a0 CONTRIBUTING SHA1 8eb329a4ed46b8574bc4d82c4ade51aaafd895b7 COPYRIGHT SHA1 e4ce1511c19eb8bd5b09ab2cee36146a6a267f82 CREDITS SHA1 aea739b4986cdcf8f92e99f544acf5d5448ff971 Changes SHA1 f32ef865cde436fef22b1d4903830d77e19f83f0 INSTALL SHA1 34f5e12514b91055de4b164a1f2327ef5c30ba53 LICENSE SHA1 3c416c70198c49f87377e6a5d0ece7b776f49405 MANIFEST SHA1 bbee636a559573bec1251637da02782630bea549 META.json SHA1 cf4968c05d2353e6f7025ffb31adc9739d6d44e5 META.yml SHA1 dae802e95bc65405b167136360de8e640af2890b Makefile.PL SHA1 0d935ae34c49bef20a8da8e8e40969c6c672b149 README SHA1 fc93ad5e65a659604746043c8582c2a9b5b29558 dist.ini SHA1 abed6fa72c15b5bb342c66a1ba582fc4e9851f8f doap.ttl SHA1 73f676486a1d6199baeb32ed4fdc95962f94eb4c lib/XML/Saxon/XSLT2.pm SHA1 fc8953186e0e56392c5b35230aa3a6f0832eadbb t/01basic.t -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAlQhK1IACgkQzr+BKGoqfTnn7gCeODuM8YI0nNEtrymE0/v6uhBE GNsAniuH3t3xS9V62y55AXr42q0u86ls =4lGz -----END PGP SIGNATURE----- dist.ini000664001750001750 10012410225503 14316 0ustar00taitai000000000000XML-Saxon-XSLT2-0.010;;class='Dist::Inkt::Profile::TOBYINK' ;;name='XML-Saxon-XSLT2' doap.ttl000664001750001750 3370312410225512 14401 0ustar00taitai000000000000XML-Saxon-XSLT2-0.010@prefix dc: . @prefix doap: . @prefix doap-bugs: . @prefix doap-changeset: . @prefix doap-deps: . @prefix foaf: . @prefix owl: . @prefix rdfs: . @prefix xsd: . a doap:Project; dc:contributor ; doap-bugs:issue , , , , , , , ; doap-deps:runtime-requirement [ doap-deps:on "perl 5.008000"^^doap-deps:CpanId ], [ doap-deps:on "Inline::Java"^^doap-deps:CpanId ], [ doap-deps:on "XML::LibXML 1.60"^^doap-deps:CpanId ]; doap-deps:test-requirement [ doap-deps:on "Test::More 0.61"^^doap-deps:CpanId ]; doap:bug-database ; doap:category [ rdfs:label "XSL transformations" ], [ rdfs:label "XSLT" ], [ rdfs:label "Java" ]; doap:created "2010-07-14"^^xsd:date; doap:developer ; doap:documenter ; doap:download-page ; doap:homepage ; doap:license ; doap:maintainer ; doap:name "XML-Saxon-XSLT2"; doap:programming-language "Perl"; doap:release , , , , , , , , , ; doap:repository [ a doap:GitRepository; doap:browse ; ]; doap:shortdesc "process XSLT 2.0 using Saxon 9.x"@en; doap:tester . a doap:Version; rdfs:label "Original version"@en; dc:issued "2010-07-15"^^xsd:date; doap:file-release ; doap:revision "0.001"^^xsd:string. a doap:Version; dc:issued "2010-07-15"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Addition; rdfs:label "Can capture output from ."@en; ], [ a doap-changeset:Addition; rdfs:label "Can specify a base URI in the constructor."@en; ], [ rdfs:label "No longer default to 'xml' output method, but respect XSLT's specified output method."@en; ]; doap-changeset:versus ; ]; doap:file-release ; doap:revision "0.002"^^xsd:string. a doap:Version; dc:issued "2010-07-19"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Addition; rdfs:label "Can determine media-type, doctype-public, doctype-system, encoding and version attributes."@en; ]; doap-changeset:versus ; ]; doap:file-release ; doap:revision "0.003"^^xsd:string. a doap:Version; dc:issued "2011-02-18"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Addition; rdfs:label "Allow parameters to be passed through to Inline::Java from the 'use' line."@en; ]; doap-changeset:versus ; ]; doap:file-release ; doap:revision "0.004"^^xsd:string. a doap:Version; dc:issued "2011-10-03"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Bugfix; rdfs:label "Change how $classpath is constructed."@en; doap-changeset:fixes [ rdfs:label "Classpath is searched in wrong order"; doap-bugs:id "66276"; ]; ]; doap-changeset:versus ; ]; doap:file-release ; doap:revision "0.005"^^xsd:string. a doap:Version; dc:issued "2011-10-06"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Packaging; rdfs:label "Upgrade Module::Package::RDF version."@en; ], [ a doap-changeset:Documentation; rdfs:label "Mention that the 'default' value for the output format of the 'transform' method is broken."@en; ]; doap-changeset:versus ; ]; doap:file-release ; doap:revision "0.006"^^xsd:string. a doap:Version; rdfs:label "Shaken, not stirred"@en; dc:issued "2012-09-11"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Packaging; rdfs:label "Drop common::sense dependency."@en; ], [ a doap-changeset:Documentation; rdfs:label "Improve documentation of base URIs."@en; doap-changeset:fixes ; ], [ a doap-changeset:Documentation; rdfs:label "Improve documentation of import function."@en; ]; doap-changeset:versus ; ]; doap:file-release ; doap:revision "0.007"^^xsd:string. a doap:Version; dc:identifier "XML-Saxon-XSLT2-0.008"^^xsd:string; dc:issued "2014-09-10"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Packaging; rdfs:label "Switch to Dist::Inkt."; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.008"^^xsd:string. a doap:Version; dc:identifier "XML-Saxon-XSLT2-0.009"^^xsd:string; dc:issued "2014-09-15"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ rdfs:label "Add `/usr/local/share/java/classes/saxon9he.jar` to the list of paths where Saxon may be found."; doap-changeset:thanks ; rdfs:comment "For FreeBSD"; rdfs:seeAlso ; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.009"^^xsd:string. a doap:Version; dc:identifier "XML-Saxon-XSLT2-0.010"^^xsd:string; dc:issued "2014-09-23"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ rdfs:label "Add `/usr/local/share/java/classes/saxon9he.jar` to Makefile.PL too."; rdfs:comment "For FreeBSD"; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.010"^^xsd:string. a foaf:Person; doap:name "Slaven Rezić"; foaf:nick "SREZIC"; foaf:page . a doap-bugs:Issue; rdfs:label "mismatch Manifest"; dc:created "2010-08-21T05:04:04"^^xsd:dateTime; dc:modified "2010-08-23T17:33:00"^^xsd:dateTime; doap-bugs:assignee _:B1; doap-bugs:id "60584"^^xsd:string; doap-bugs:page ; doap-bugs:reporter _:B2; doap-bugs:status . a doap-bugs:Issue; rdfs:label "usage more explicit?"; dc:created "2010-08-21T14:24:06"^^xsd:dateTime; dc:modified "2011-02-18T23:20:58"^^xsd:dateTime; doap-bugs:assignee _:B1; doap-bugs:id "60589"^^xsd:string; doap-bugs:page ; doap-bugs:reporter _:B2; doap-bugs:status . a doap-bugs:Issue; rdfs:label ""; dc:created "2010-08-23T17:32:51"^^xsd:dateTime; dc:modified "2011-02-18T22:47:26"^^xsd:dateTime; doap-bugs:assignee _:B3; doap-bugs:id "60645"^^xsd:string; doap-bugs:page ; doap-bugs:reporter _:B2; doap-bugs:status . a doap-bugs:Issue; rdfs:label "variable memory requirements"; dc:created "2010-08-23T17:37:21"^^xsd:dateTime; dc:modified "2011-02-18T23:19:31"^^xsd:dateTime; doap-bugs:assignee _:B1; doap-bugs:id "60646"^^xsd:string; doap-bugs:page ; doap-bugs:reporter _:B2; doap-bugs:status . a doap-bugs:Issue; rdfs:label "measuring performance"; dc:created "2010-08-23T17:51:32"^^xsd:dateTime; dc:modified "2011-02-18T23:13:18"^^xsd:dateTime; doap-bugs:assignee _:B3; doap-bugs:id "60648"^^xsd:string; doap-bugs:page ; doap-bugs:reporter _:B2; doap-bugs:status . a doap-bugs:Issue; rdfs:label "Classpath is searched in wrong order"; dc:created "2011-03-01T09:32:22"^^xsd:dateTime; dc:modified "2011-10-03T22:33:21"^^xsd:dateTime; doap-bugs:assignee _:B1; doap-bugs:id "66276"^^xsd:string; doap-bugs:page ; doap-bugs:reporter _:B4; doap-bugs:status . a doap-bugs:Issue; rdfs:label "xsl:result-document element doesn't work"; dc:created "2011-03-01T10:46:58"^^xsd:dateTime; dc:modified "2011-10-03T21:47:56"^^xsd:dateTime; doap-bugs:assignee _:B1; doap-bugs:id "66278"^^xsd:string; doap-bugs:page ; doap-bugs:reporter _:B4; doap-bugs:status . a doap-bugs:Issue; rdfs:label "Insufficient documentation - baseuri"; dc:created "2012-09-05T22:35:39"^^xsd:dateTime; dc:modified "2012-09-11T12:44:53"^^xsd:dateTime; doap-bugs:assignee _:B1; doap-bugs:id "79463"^^xsd:string; doap-bugs:page ; doap-bugs:reporter [ a foaf:Agent; foaf:mbox ; ]; doap-bugs:status . a doap-bugs:Issue; doap-bugs:id "98875"^^xsd:string; doap-bugs:page . a foaf:Person; foaf:homepage ; foaf:mbox ; foaf:name "Toby Inkster"; foaf:page ; owl:sameAs . _:B2 a foaf:Agent; foaf:mbox . _:B1 a foaf:Agent; foaf:nick "TOBYINK". _:B3 a foaf:Agent; foaf:nick "Nobody". _:B4 a foaf:Agent; foaf:mbox . 01basic.t000664001750001750 244012410225503 14555 0ustar00taitai000000000000XML-Saxon-XSLT2-0.010/t## skip Test::Tabs use Test::More tests => 4; use XML::Saxon::XSLT2; my $xslt = <<'XSLT'; XSLT my $input = <<'XML'; XML my $transformation = XML::Saxon::XSLT2->new($xslt); $transformation->parameters('bar' => [date=>'2010-02-28']); my $output = $transformation->transform_document($input, 'xml'); is($output->documentElement->getAttribute('foo'), '2010-02-28'); my @authors = $output->getElementsByTagName('author'); is($authors[0]->getAttribute('id'), 'Dave Thomas'); is($authors[1]->getAttribute('id'), 'Dave Thomas'); is($authors[2]->getAttribute('id'), 'Jack Herrington'); XSLT2.pm000664001750001750 3334712410225503 16445 0ustar00taitai000000000000XML-Saxon-XSLT2-0.010/lib/XML/Saxonuse 5.008; use strict; use warnings; ## skip Test::Tabs package XML::Saxon::XSLT2; use Carp; use IO::Handle; use Scalar::Util qw[blessed]; use XML::LibXML; our $AUTHORITY = 'cpan:TOBYINK'; our $VERSION = '0.010'; my $classpath; BEGIN { foreach my $path (qw( /usr/share/java/saxon9he.jar /usr/local/share/java/saxon9he.jar /usr/share/java/saxonb.jar /usr/local/share/java/saxonb.jar /usr/local/share/java/classes/saxon9he.jar )) { $classpath = $path if -e $path; last if defined $classpath; } require Inline; } sub import { my ($class, @args) = @_; shift @args if @args && exists $args[0] && defined $args[0] && $args[0] =~ /^[\d\.\_]{1,10}$/; Inline->import( Java => 'DATA', CLASSPATH => $classpath, @args ); } sub new { my ($class, $xslt, $baseurl) = @_; $xslt = $class->_xml($xslt); if ($baseurl) { return bless { 'transformer' => XML::Saxon::XSLT2::Transformer->new($xslt, $baseurl) }, $class; } else { return bless { 'transformer' => XML::Saxon::XSLT2::Transformer->new($xslt) }, $class; } } sub parameters { my ($self, %params) = @_; $self->{'transformer'}->paramClear(); while (my ($k,$v) = each %params) { if (ref $v eq 'ARRAY') { (my $type, $v) = @$v; my $func = 'paramAdd' . { double => 'Double', string => 'String', long => 'Long', 'int' => 'Long', integer => 'Long', decimal => 'Decimal', float => 'Float', boolean => 'Boolean', bool => 'Boolean', qname => 'QName', uri => 'URI', date => 'Date', datetime => 'DateTime', }->{lc $type}; croak "$type is not a supported type" if $func eq 'paramAdd'; $self->{'transformer'}->$func($k, $v); } elsif (blessed($v) && $v->isa('DateTime')) { $self->{'transformer'}->paramAddDateTime($k, "$v"); } elsif (blessed($v) && $v->isa('Math::BigInt')) { $self->{'transformer'}->paramAddLong($k, $v->bstr); } elsif (blessed($v) && $v->isa('URI')) { $self->{'transformer'}->paramAddURI($k, "$v"); } else { $self->{'transformer'}->paramAddString($k, "$v"); } } return $self; } sub transform { my ($self, $doc, $type) = @_; $type = ($type =~ /^(text|html|xhtml|xml)$/i) ? (lc $type) : 'default'; $doc = $self->_xml($doc); return $self->{'transformer'}->transform($doc, $type); } sub transform_document { my $self = shift; my $r = $self->transform(@_); $self->{'parser'} ||= XML::LibXML->new; return $self->{'parser'}->parse_string($r); } sub messages { my ($self) = @_; return @{ $self->{'transformer'}->messages }; } sub media_type { my ($self, $default) = @_; return $self->{'transformer'}->media_type || $default; } sub doctype_public { my ($self, $default) = @_; return $self->{'transformer'}->doctype_public || $default; } sub doctype_system { my ($self, $default) = @_; return $self->{'transformer'}->doctype_system || $default; } sub version { my ($self, $default) = @_; return $self->{'transformer'}->version || $default; } sub encoding { my ($self, $default) = @_; return $self->{'transformer'}->encoding || $default; } sub _xml { my ($proto, $xml) = @_; if (blessed($xml) && $xml->isa('XML::LibXML::Document')) { return $xml->toString; } elsif (blessed($xml) && $xml->isa('IO::Handle')) { local $/; my $str = <$xml>; return $str; } elsif (ref $xml eq 'GLOB') { local $/; my $str = <$xml>; return $str; } return $xml; } 1; =head1 NAME XML::Saxon::XSLT2 - process XSLT 2.0 using Saxon 9.x. =head1 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'); =head1 DESCRIPTION This module implements XSLT 1.0 and 2.0 using Saxon 9.x via L. 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 L - 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. =head2 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 C function I be called. If you load this module without importing it, it will not work. (Don't worry, it won't pollute your namespace.) =head2 Constructor =over 4 =item C<< XML::Saxon::XSLT2->new($xslt, [$baseurl]) >> Creates a new transformation. $xslt may be a string, a file handle or an L. $baseurl is an optional base URL for resolving relative URL references in, for instance, Exsl:importE links. Otherwise, the current directory is assumed to be the base. (For base URIs which are filesystem directories, remember to include the trailing slash.) =back =head2 Methods =over 4 =item C<< $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 L object, which is treated as an xs:dateTime; a L object, xs:anyURI; a L, 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. =item C<< $trans->transform($doc, [$output_method]) >> Run a transformation, returning the output as a string. $doc may be a string, a file handle or an L. $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. :-( =item C<< $trans->transform_document($doc, [$output_method]) >> As per , but returns the output as an L. This method is slower than C. =item C<< $trans->messages >> Returns a list of string representations of messages output by Exsl:messageE during the last transformation run. =item C<< $trans->media_type($default) >> Returns the output media type for the transformation. If the transformation doesn't specify an output type, returns the default. =item C<< $trans->doctype_public($default) >> Returns the output DOCTYPE public identifier for the transformation. If the transformation doesn't specify a doctype, returns the default. =item C<< $trans->doctype_system($default) >> Returns the output DOCTYPE system identifier for the transformation. If the transformation doesn't specify a doctype, returns the default. =item C<< $trans->version($default) >> Returns the output XML version for the transformation. If the transformation doesn't specify a version, returns the default. =item C<< $trans->encoding($default) >> Returns the output encoding for the transformation. If the transformation doesn't specify an encoding, returns the default. =back =head1 BUGS Please report any bugs to L. =head1 SEE ALSO L 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 L. L. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 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. =cut __DATA__ __Java__ import net.sf.saxon.s9api.*; import org.xml.sax.Attributes; import org.xml.sax.ContentHandler; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.xml.sax.helpers.XMLFilterImpl; import org.w3c.dom.Document; import org.xml.sax.Attributes; import org.xml.sax.ContentHandler; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.xml.sax.helpers.XMLFilterImpl; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import javax.xml.transform.ErrorListener; import javax.xml.transform.SourceLocator; import javax.xml.transform.TransformerException; import javax.xml.transform.sax.SAXSource; import javax.xml.transform.stream.StreamSource; import javax.xml.transform.OutputKeys; import java.io.*; import java.math.BigDecimal; import java.net.URI; import java.util.*; public class Transformer { private XsltExecutable xslt; private Processor proc; private HashMap params; public List messagelist; public Transformer (String stylesheet) throws SaxonApiException { proc = new Processor(false); XsltCompiler comp = proc.newXsltCompiler(); xslt = comp.compile(new StreamSource(new StringReader(stylesheet))); params = new HashMap(); messagelist = new ArrayList(); } public Transformer (String stylesheet, String baseuri) throws SaxonApiException { proc = new Processor(false); XsltCompiler comp = proc.newXsltCompiler(); xslt = comp.compile(new StreamSource(new StringReader(stylesheet), baseuri)); params = new HashMap(); messagelist = new ArrayList(); } public void paramAddString (String key, String value) { params.put(key, new XdmAtomicValue(value)); } public void paramAddLong (String key, long value) { params.put(key, new XdmAtomicValue(value)); } public void paramAddDecimal (String key, BigDecimal value) { params.put(key, new XdmAtomicValue(value)); } public void paramAddFloat (String key, float value) { params.put(key, new XdmAtomicValue(value)); } public void paramAddDouble (String key, double value) { params.put(key, new XdmAtomicValue(value)); } public void paramAddBoolean (String key, boolean value) { params.put(key, new XdmAtomicValue(value)); } public void paramAddURI (String key, String value) throws java.net.URISyntaxException { params.put(key, new XdmAtomicValue(new URI(value.toString()))); } public void paramAddQName (String key, String value) { params.put(key, new XdmAtomicValue(new QName(value.toString()))); } public void paramAddDate (String key, String value) throws SaxonApiException { ItemTypeFactory itf = new ItemTypeFactory(proc); ItemType dateType = itf.getAtomicType(new QName("http://www.w3.org/2001/XMLSchema", "date")); params.put(key, new XdmAtomicValue(value, dateType)); } public void paramAddDateTime (String key, String value) throws SaxonApiException { ItemTypeFactory itf = new ItemTypeFactory(proc); ItemType dateTimeType = itf.getAtomicType(new QName("http://www.w3.org/2001/XMLSchema", "datetime")); params.put(key, new XdmAtomicValue(value, dateTimeType)); } public XdmAtomicValue paramGet (String key) { return params.get(key); } public void paramRemove (String key) { params.remove(key); } public void paramClear () { params.clear(); } public Object[] messages () { return messagelist.toArray(); } public String media_type () { return xslt.getUnderlyingCompiledStylesheet().getOutputProperties().getProperty(OutputKeys.MEDIA_TYPE); } public String doctype_public () { return xslt.getUnderlyingCompiledStylesheet().getOutputProperties().getProperty(OutputKeys.DOCTYPE_PUBLIC); } public String doctype_system () { return xslt.getUnderlyingCompiledStylesheet().getOutputProperties().getProperty(OutputKeys.DOCTYPE_SYSTEM); } public String method () { return xslt.getUnderlyingCompiledStylesheet().getOutputProperties().getProperty(OutputKeys.METHOD); } public String version () { return xslt.getUnderlyingCompiledStylesheet().getOutputProperties().getProperty(OutputKeys.VERSION); } public String standalone () { return xslt.getUnderlyingCompiledStylesheet().getOutputProperties().getProperty(OutputKeys.STANDALONE); } public String encoding () { return xslt.getUnderlyingCompiledStylesheet().getOutputProperties().getProperty(OutputKeys.ENCODING); } public String indent () { return xslt.getUnderlyingCompiledStylesheet().getOutputProperties().getProperty(OutputKeys.INDENT); } public String transform (String doc, String method) throws SaxonApiException { XdmNode source = proc.newDocumentBuilder().build( new StreamSource(new StringReader(doc)) ); XsltTransformer trans = xslt.load(); trans.setInitialContextNode(source); Serializer out = new Serializer(); StringWriter sw = new StringWriter(); out.setOutputWriter(sw); trans.setDestination(out); if (!method.equals("default")) { out.setOutputProperty(Serializer.Property.METHOD, method); } Iterator i = params.keySet().iterator(); while (i.hasNext()) { Object k = i.next(); XdmAtomicValue v = params.get(k); trans.setParameter(new QName(k.toString()), v); } messagelist.clear(); trans.setMessageListener( new MessageListener() { public void message(XdmNode content, boolean terminate, SourceLocator locator) { messagelist.add(content.toString()); } } ); trans.transform(); return sw.toString(); } }