The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
Changes 5985
LibXSLT.pm 321
LibXSLT.xs 24756
MANIFEST 04
META.json 210
META.yml 25
Makefile.PL 829
README 33
benchmark/benchmark.pl 2121
example/1.xsl 22
perl-libxml-mm.c 1313
perl-libxml-mm.h 1414
scripts/tag-release.pl 027
t/03input.t 2878
t/04params.t 22
t/06output.t 44
t/07blankdoc.t 22
t/10functions.t 2576
t/11utf8.t 11
t/12import.t 11
t/13error.t 22
t/14security.t 44
t/cpan-changes.t 012
t/pod.t 06
t/rt71345_a.t 11
t/rt71345_b.t 11
t/style-trailing-space.t 030
27 files changed (This is a version diff) 445510
@@ -1,72 +1,106 @@
 Revision history for Perl extension XML::LibXSLT.
 
-1.88            Mon 17 Feb 14:44:34 IST 2014
+1.92    2014-04-12
+    - Add scripts/tag-release.pl .
+
+1.91    2014-04-12
+    - t/cpan-changes.t : minimum version of Test::CPAN::Changes.
+        - This is to avoid test failures such as:
+            - http://www.cpantesters.org/cpan/report/5af7d5eb-6bfa-1014-b84e-eb85912f2992
+
+1.90    2014-04-10
+    - Handle $Config{dlext} correctly on Windows.
+        - https://rt.cpan.org/Ticket/Display.html?id=94516
+        - Thanks to kmx for the report and fix.
+    - Add t/pod.t .
+        - Fix some POD problems.
+    - Add t/cpan-changes.t and convert Changes to CPAN::Changes format.
+    - Add t/style-trailing-space.t.
+        - Remove trailing whitespace.
+
+1.89    2014-03-05
+    - Fix memory management of node-sets returned from extension functions.
+      Without calling xsltExtensionInstructionResultRegister, node-sets
+      could be freed too early, leading to strange errors or segfaults.
+        - https://bugzilla.gnome.org/show_bug.cgi?id=562302
+        - https://rt.cpan.org/Ticket/Display.html?id=93349
+        - Thanks to Alexander Schepanovski for the report.
+    - Document input_callbacks methods
+    - Don't register libxml2 input callbacks twice
+        - https://rt.cpan.org/Public/Bug/Display.html?id=60313
+    - Fix memory leak with extension functions returning node lists
+        - https://rt.cpan.org/Public/Bug/Display.html?id=55623
+        - https://rt.cpan.org/Public/Bug/Display.html?id=76596
+        - Thanks to Jozef Kutej and Slaven Rezic for the reports.
+    - Thanks to Nick Wellnhofer for the pull requests and fixes.
+
+1.88    2014-02-17
     - Fix t/xml-grammar-failures.t based on the xml:space commentary here:
         - https://mail.gnome.org/archives/xml/2014-February/msg00000.html
         - Caused some failures which were ultimately our fault.
 
-1.87            Mon  3 Feb 10:07:31 IST 2014
+1.87    2014-02-03
     - Decrease the minimum libxslt version again.
         - Setting it as 1.1.28 did not fix the failures, and now we have
         some more tests to test against it.
         - https://rt.cpan.org/Ticket/Display.html?id=92659
         - Thanks to Slaven Rezic for the report.
 
-1.86            Sun  2 Feb 17:06:07 IST 2014
+1.86    2014-02-02
     - Add t/xml-grammar-failures.t to catch test failures in dependent modules.
         - Add some data files for it under t/data/*.
         - This fails on FreeBSD 9.2 currently.
 
-1.85            Sat  1 Feb 16:23:43 IST 2014
+1.85    2014-02-01
     - Add "use strict;" and "use warnings;" globally (CPANTS).
     - Add LICENSE to the MANIFEST.
 
-1.84            Thu 26 Dec 14:19:19 IST 2013
+1.84    2013-12-26
     - Hopefully fix a segmentation fault on Win32 introduced in the last ver.
         - https://rt.cpan.org/Ticket/Display.html?id=91652
         - Thanks to Alexandr Ciornii for the report, and to Nikolay Sivov
         for providing help.
 
-1.83            Sun 22 Dec 18:20:23 IST 2013
+1.83    2013-12-22
     - Get rid of compiler warnings when compiling using CLANG.
         - https://rt.cpan.org/Public/Bug/Display.html?id=91118
         - Thanks to Daniel Macks for the report.
 
-1.82            Wed  6 Nov 13:17:39 IST 2013
+1.82    2013-11-06
     - Makefile.PL: Report LibXSLT mismatch correctly.
         - https://rt.cpan.org/Ticket/Display.html?id=90085
         - Thanks to David Schmidt for the report, and to joel and brother
         from the channel #perl-help for analysis.
 
-1.81            Fri  5 Jul 10:13:36 IDT 2013
+1.81    2013-07-05
     - Fix a typo reported by dsteinbrunner:
         - https://rt.cpan.org/Ticket/Display.html?id=86689
 
-1.80            Wed 23 Jan 07:53:57 IST 2013
+1.80    2013-01-23
     - Bump the minimum version of libxslt2 to 1.1.28.
         - due to failures such as http://www.cpantesters.org/cpan/report/6f5029ee-639a-11e2-8465-2a97270fb964
 
-1.79            Mon 26 Nov 12:15:35 IST 2012
+1.79    2012-11-26
     - Die when libxslt is 1.1.27.
         - Due to this bug - https://bugzilla.gnome.org/show_bug.cgi?id=684564
 
-1.78            Thu  6 Sep 13:17:28 IDT 2012
+1.78    2012-09-06
     - Add output_method method, update documentation of media_type
     (dorian@cpan).
         - Thanks, Dorian!
 
-1.77            Sat Feb 25 16:23:57 IST 2012
+1.77    2012-02-25
     - Apply a patch from Michael Ludwig clarifying the quoting of string
     parameters to the XSLT transformation.
         - Thanks, Michael!
 
-1.76            Thu Jan 12 19:15:03 IST 2012
+1.76    2012-01-12
     - Made LibXSLT.xs compile with C compilers that don't accept declarations
     inside blocks:
         - https://rt.cpan.org/Public/Bug/Display.html?id=73905
         - These include Microsoft Visual C++ (in C-mode).
 
-1.75            Fri Oct 28 17:26:57 IST 2011
+1.75    2011-10-28
     - Convert the following test scripts from Test.pm to Test::More :
         - t/03input.t
     - Fix for https://rt.cpan.org/Public/Bug/Display.html?id=71345 by Tim
@@ -74,7 +108,7 @@ Revision history for Perl extension XML::LibXSLT.
         - «segfault in free()»
         - Thanks, Tim!
 
-1.74            Tue Oct 25 21:48:48 IST 2011
+1.74    2011-10-25
     - Convert the following test scripts from Test.pm to Test::More :
         - t/01basic.t
         - t/02dromeds.t
@@ -98,12 +132,12 @@ Revision history for Perl extension XML::LibXSLT.
     - Add the "make runtest" and "make distruntest" targets to test using
     Test-Run.
 
-1.73            Sun Oct  9 17:32:30 IST 2011
+1.73    2011-10-09
     - Possible fix for https://rt.cpan.org/Ticket/Display.html?id=71456 :
         - made the port reservation on t/14security.t for the non-existent
         URL more robust.
 
-1.72            Thu Oct  6 13:37:13 IST 2011
+1.72    2011-10-06
     - Moved the benchmarking code under benchmark/ so it won't be indexed
     by CPAN (Tim Brody).
     - Avoid leaking memory inside extension elements by cleaning up on
@@ -117,7 +151,7 @@ Revision history for Perl extension XML::LibXSLT.
     may leak memory though - nothing frees the _private attributes of the
     node + document owner for the passed arguments? (Tim Brody)
 
-1.71            Sat Sep 10 20:38:23 IDT 2011
+1.71    2011-09-10
     - Fixed https://rt.cpan.org/Ticket/Display.html?id=50487 :
         - add a blacklist for libxslt-1.1.25 which has a deadlock that
         hangs a test.
@@ -125,7 +159,7 @@ Revision history for Perl extension XML::LibXSLT.
         - Unexpected webserver dependency in test
     - Updated the version control instructions in the README to bitbucket.org.
 
-1.70
+1.70     Unknown
      - fixed various bugs
      - documentation updates
      - #48247: Win32 patch kindly provided by KMX@cpan.org
@@ -135,25 +169,25 @@ Revision history for Perl extension XML::LibXSLT.
      - address #41542: restore internalDTD subset on the source
        document of a transformation (libxslt unlinks it)
 
-1.68
+1.68     Unknown
      - fix compilation problems
      - skip exslt tests if not available
      - added XML::LibXSLT::HAVE_EXSLT() (1/0)
 
-1.67
+1.67     Unknown
      - sync the binary internals to those of XML::LibXML 1.67
      - update regression tests for compatibility with up-to-date libxslt
 
-1.66
+1.66     Unknown
      - bump requirements to libxslt 1.1.8
      - sync the binary internals to those of XML::LibXML 1.66
 
-1.63
+1.63     Unknown
      - fix SIGSEGV regarding freeing nodes created by extension functions
        (reported by Elizabeth Mattijsen)
      - use pkg-config to determine linker flags for libexslt
 
-1.62
+1.62     Unknown
      - security callback interface contributed by Shane Corgatelli
      - check libxslt version
      - added XML::LibXML-like API to retrieve libxslt version
@@ -164,11 +198,11 @@ Revision history for Perl extension XML::LibXSLT.
      - POD uses items instead of headings
      - fixed media_type and output_encoding for imported stylesheets [rt.cpan.org #23440]
 
-1.61
+1.61     Unknown
      - fixed error reporting: die on fatal errors, warn otherwise
        (in particular, warn rather than die on <xsl:message terminate="no">)
 
-1.60
+1.60     Unknown
      - fix a huge memory leak in transform_file (bug #1314)
      - make it clear from the docs that output_string returns bytes (bug #8875)
      - added missing type-casting to fix compile-time warnings (bug #18508)
@@ -181,12 +215,13 @@ Revision history for Perl extension XML::LibXSLT.
      - fix leaks in parse_stylesheet
      - error reporting
 
-1.59
-    - (revision bumped to match XML::LibXML)
+1.59     Unknown
+    - (revision bumped to match XML::LibCould not parse Line '0.95 & 0.96' at /home/shlomif/bin/upgrade-to-CPAN-Changes line 40, <STDIN> line 300.
+XML)
     - adapted for new XML::LibXML::InputCallback API
     - support for static linking against libxml2
 
-1.57
+1.57     Unknown
     - (revision bumped to match XML::LibXML)
     - Some minor fixes to perl extension functions support
     - Fixed callbacks support
@@ -194,94 +229,85 @@ Revision history for Perl extension XML::LibXSLT.
     - Fixed some memory leaks
     - Fixed some segfaults
 
-1.53
+1.53     Unknown
     - Fixed ordering of params to perl extension funcs
     - Implemented nodelist and other data type passing to
       extension functions, and returning nodelist and elements
       (some code from Ido Ben-Zvi)
     - Slightly better error handling
 
-1.52
+1.52     Unknown
     - Perl extension functions (whee!)
 
-1.51
+1.51     Unknown
     - Mac OS X fixes
     - Cleaned up XPath quoting
     - Fixed document('') test (though if it still doesn't work
       in your code, see t/07blankdoc.t for details about how to
       make it work).
 
-1.50
+1.50     Unknown
     - Cleaned up media_type method so it doesn't segfault.
 
-1.49
+1.49     Unknown
     - Migrated to new XML::LibXML 1.49 (with new memory stuff)
 
-1.31
+1.31     Unknown
     - removed global callbacks
     - changed callbacks to using LibXML globals
 
-1.30
+1.30     Unknown
     - Compatibility with XML::LibXML 1.30 (esp callbacks)
     - EXSLT support
     - Better test files
 
-1.09
+1.09     Unknown
     - Some fixes and tests for document('')
     - Better have_library implementation in Makefile.PL
 
-1.08
+1.08     Unknown
     - Fixed Makefile.PL check for libxslt > 0.7.0 to work with 1.0.0
 
-1.07
+1.07     Unknown
     - Fixes to work with XML::LibXML 0.94
 
-1.06
+1.06     Unknown
     - Support text/html defaulting for media_type when document element
       is <html>.
     - Support building on Win32
 
-1.05
+1.05     Unknown
     - More tests and fixes for media_type
 
-1.04
+1.04     Unknown
     - Fixed media_type method
 
-1.03
+1.03     Unknown
     - Added output_encoding and media_type methods
 
-1.02
+1.02     Unknown
     - Fixed Makefile.PL to work with libxslt 0.10
 
-1.01
+1.01     Unknown
     - Removed hack where we set dom->standalone = 42 to prevent
       XML::LibXML from garbage collecting
     - Removed XML::LibXML from the distribution. Now separate.
 
-1.00
+1.00     Unknown
     - More segfault fixes
     - Benchmark updates
 
-0.99_01
+0.99_01  Unknown
     - More segfault fixes
 
-0.99
+0.99     Unknown
     - Fixed segfaults on 5.00503
 
-0.98
+0.98     Unknown
     - Fixed output encoding problems
 
-0.97
+0.97     Unknown
     - Now needs libxslt 0.7.0
     - Removed add_param() (now passed to transform())
     - Makefile.PL works without gnome-config now
 
-0.95 & 0.96
-    - Various cleanups and code additions to make stable.
-
-0.94  Tue Mar 13 2001
-    - First release to CPAN
-
-0.01  Sat Mar  3 17:08:00 2001
-	- original version; created by h2xs 1.19
-
@@ -11,6 +11,8 @@ package XML::LibXSLT;
 use strict;
 use warnings;
 
+use 5.008;
+
 use vars qw($VERSION @ISA $USE_LIBXML_DATA_TYPES $MatchCB $ReadCB $OpenCB $CloseCB);
 
 sub REQUIRE_XML_LIBXML_ABI_VERSION { 2 }
@@ -27,7 +29,7 @@ use Carp;
 
 require Exporter;
 
-$VERSION = '1.88';
+$VERSION = '1.92';
 
 require DynaLoader;
 
@@ -230,7 +232,6 @@ sub _init_callbacks{
         $icb->register_callbacks( [$mcb, $ocb, $rcb, $ccb] );
     }
 
-    $self->lib_init_callbacks();
     $icb->init_callbacks();
 }
 
@@ -438,7 +439,6 @@ sub _init_callbacks {
     if ( defined $mcb and defined $ocb and defined $rcb and defined $ccb ) {
         $icb->register_callbacks( [$mcb, $ocb, $rcb, $ccb] );
     }
-    $self->XML::LibXSLT::lib_init_callbacks();
     $icb->init_callbacks();
 
     my $scb = $self->{XML_LIBXSLT_SECPREFS};
@@ -768,6 +768,17 @@ To define XML::LibXSLT or XML::LibXSLT::Stylesheet specific input
 callbacks, reuse the XML::LibXML input callback API as described in
 L<XML::LibXML::InputCallback(3)>.
 
+=over 4
+
+=item input_callbacks($icb)
+
+Enable the callbacks in C<$icb> only for this XML::LibXSLT object.
+C<$icb> should be a C<XML::LibXML::InputCallback> object. This will
+call C<init_callbacks> and C<cleanup_callbacks> automatically during
+parsing or transformation.
+
+=back
+
 =head1 Security Callbacks
 
 To create security preferences for the transformation see
@@ -858,6 +869,13 @@ C<xsl:output>. If this attribute is unspecified, the default media
 type is initially C<text/xml>. This default changes to C<text/html>
 under the same conditions as L<output_method>.
 
+=item input_callbacks($icb)
+
+Enable the callbacks in C<$icb> only for this stylesheet. C<$icb>
+should be a C<XML::LibXML::InputCallback> object. This will call
+C<init_callbacks> and C<cleanup_callbacks> automatically during
+transformation.
+
 =back
 
 =cut
@@ -75,11 +75,11 @@ int
 LibXSLT_iowrite_scalar(void * context, const char * buffer, int len)
 {
     SV * scalar;
-    
+
     scalar = (SV *)context;
 
     sv_catpvn(scalar, (const char*)buffer, len);
-    
+
     return len;
 }
 
@@ -93,17 +93,17 @@ int
 LibXSLT_iowrite_fh(void * context, const char * buffer, int len)
 {
     dSP;
-    
+
     SV * ioref;
     SV * tbuff;
     SV * results;
     int cnt;
-    
+
     ENTER;
     SAVETMPS;
-    
+
     ioref = (SV *)context;
-    
+
     tbuff = newSVpvn((char*)buffer, len);
 
     PUSHMARK(SP);
@@ -111,26 +111,26 @@ LibXSLT_iowrite_fh(void * context, const char * buffer, int len)
     PUSHs(ioref);
     PUSHs(sv_2mortal(tbuff));
     PUTBACK;
-    
+
     cnt = call_method("print", G_SCALAR | G_EVAL);
-    
+
     SPAGAIN;
-    
+
     if (cnt != 1) {
         croak("fh->print() method call failed");
     }
-    
+
     results = POPs;
-    
+
     if (!SvOK(results)) {
         croak("print to fh failed");
     }
-    
+
     PUTBACK;
-    
+
     FREETMPS;
     LEAVE;
-    
+
     return len;
 }
 
@@ -184,10 +184,10 @@ void
 LibXSLT_debug_handler(void * ctxt, const char * msg, ...)
 {
     dSP;
-    
+
     va_list args;
     SV * sv;
-    
+
     sv = NEWSV(0,512);
 
     va_start(args, msg);
@@ -196,10 +196,10 @@ LibXSLT_debug_handler(void * ctxt, const char * msg, ...)
 
     if (LibXSLT_debug_cb && SvTRUE(LibXSLT_debug_cb)) {
         int cnt = 0;
-    
+
         ENTER;
         SAVETMPS;
-        
+
         PUSHMARK(SP);
         EXTEND(SP, 1);
         PUSHs(sv);
@@ -218,7 +218,7 @@ LibXSLT_debug_handler(void * ctxt, const char * msg, ...)
         FREETMPS;
         LEAVE;
     }
-    
+
     SvREFCNT_dec(sv);
 }
 
@@ -241,11 +241,11 @@ LibXSLT__function (xmlXPathParserContextPtr ctxt, int nargs, SV *perl_function)
     xmlDocPtr container = NULL;
     xsltTransformContextPtr tctxt = xsltXPathGetTransformContext(ctxt);
     dSP;
-    
+
     ENTER;
     SAVETMPS;
     PUSHMARK(SP);
-    
+
     XPUSHs(perl_function);
 
 	/* clone all of the arguments into a new owning document */
@@ -316,25 +316,25 @@ LibXSLT__function (xmlXPathParserContextPtr ctxt, int nargs, SV *perl_function)
 
     perl_dispatch = sv_2mortal(newSVpv("XML::LibXSLT::perl_dispatcher",0));
     count = call_sv(perl_dispatch, G_SCALAR|G_EVAL);
-    
+
     SPAGAIN;
 
     if (SvTRUE(ERRSV)) {
         (void) POPs;
         croak("LibXSLT: error coming back from perl-dispatcher in pm file. %s\n", SvPV(ERRSV, n_a));
-    } 
+    }
 
     if (count != 1) croak("LibXSLT: perl-dispatcher in pm file returned more than one argument!\n");
-    
+
     perl_result = POPs;
 
     if (!SvOK(perl_result)) {
-        ret = (xmlXPathObjectPtr)xmlXPathNewCString("");		
+        ret = (xmlXPathObjectPtr)xmlXPathNewCString("");
         goto FINISH;
     }
 
     /* convert perl result structures to LibXML structures */
-    if (sv_isobject(perl_result) && 
+    if (sv_isobject(perl_result) &&
         (SvTYPE(SvRV(perl_result)) == SVt_PVMG ||
          SvTYPE(SvRV(perl_result)) == SVt_PVAV))
     {
@@ -348,17 +348,15 @@ LibXSLT__function (xmlXPathParserContextPtr ctxt, int nargs, SV *perl_function)
             while (av_len(array_result) >= 0) {
 	      tmp_node1 = (xmlNodePtr)x_PmmSvNode(sv_2mortal(av_shift(array_result)));
 	      if (tmp_node1) {
-		  container = xsltCreateRVT(tctxt);
+		container = xsltCreateRVT(tctxt);
 		if (container == NULL) {
-		  if (container == NULL) {
-		    croak("LibXSLT: perl-dispatcher: cannot create container RVT\n");
-		  }
+		  croak("LibXSLT: perl-dispatcher: cannot create container RVT\n");
+		}
 #if LIBXSLT_VERSION < 10118
-		  xsltRegisterTmpRVT(tctxt,container);
+		xsltRegisterTmpRVT(tctxt,container);
 #else
-		  xsltRegisterLocalRVT(tctxt,container);
+		xsltRegisterLocalRVT(tctxt,container);
 #endif
-		}
 		tmp_node = xmlDocCopyNode(tmp_node1, container, 1);
 		/* a wraper element is needed to wrap attributes and
 		   prevent libxml2 from merging adjacent text nodes */
@@ -370,8 +368,13 @@ LibXSLT__function (xmlXPathParserContextPtr ctxt, int nargs, SV *perl_function)
 		croak("LibXSLT: perl-dispatcher returned nodelist with non-node elements\n");
 	      }
 	    }
+            /*
+             * Mark it as a function result in order to avoid garbage
+             * collecting of tree fragments.
+             */
+            xsltExtensionInstructionResultRegister(tctxt, ret);
             goto FINISH;
-        } 
+        }
         else if (sv_derived_from(perl_result, "XML::LibXML::Node")) {
 	  tmp_node1 = (xmlNodePtr)x_PmmSvNode(perl_result);
 	  ret =  (xmlXPathObjectPtr)xmlXPathNewNodeSet(NULL);
@@ -405,6 +408,11 @@ LibXSLT__function (xmlXPathParserContextPtr ctxt, int nargs, SV *perl_function)
 	  } else {
 	    croak("LibXSLT: perl-dispatcher returned a null XML::LibXML::Node object\n");
 	  }
+          /*
+           * Mark it as a function result in order to avoid garbage
+           * collecting of tree fragments.
+           */
+          xsltExtensionInstructionResultRegister(tctxt, ret);
 	  goto FINISH;
         }
         else if (sv_derived_from(perl_result, "XML::LibXML::Boolean")) {
@@ -448,7 +456,7 @@ LibXSLT_generic_function (xmlXPathParserContextPtr ctxt, int nargs) {
 
     uri = (const char *) ctxt->context->functionURI;
     name = (const char *) ctxt->context->function;
-    
+
     key = newSVpvn("",0);
     sv_catpv(key, "{");
     sv_catpv(key, (const char*)uri);
@@ -492,7 +500,7 @@ LibXSLT_context_function (xmlXPathParserContextPtr ctxt, int nargs) {
 
     uri = (const char *) ctxt->context->functionURI;
     name = (const char *) ctxt->context->function;
-    
+
     sv_setpv(key, "{");
     sv_catpv(key, (const char*)uri);
     sv_catpv(key, "}");
@@ -542,7 +550,7 @@ LibXSLT_context_element(xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePt
 
     SvREFCNT_dec(key);
 
-    
+
     ENTER;
     SAVETMPS;
     PUSHMARK(SP);
@@ -572,7 +580,7 @@ LibXSLT_context_element(xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePt
 
     if (perlnode != &PL_sv_undef)
     {
-        result = x_PmmSvNodeExt(perlnode, 0); 
+        result = x_PmmSvNodeExt(perlnode, 0);
         if (result == NULL)
             croak("LibXSLT: element callback did not return a XML::Node");
 
@@ -585,187 +593,6 @@ LibXSLT_context_element(xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePt
     LEAVE;
 }
 
-
-int
-LibXSLT_input_match(char const * filename)
-{
-    int results;
-    int count;
-    SV * res;
-
-    results = 0;
-
-    {
-        dTHX;
-        dSP;
-
-        ENTER;
-        SAVETMPS;
-
-        PUSHMARK(SP);
-        EXTEND(SP, 1);
-        PUSHs(sv_2mortal(newSVpv((char*)filename, 0)));
-        PUTBACK;
-
-        count = call_pv("XML::LibXML::InputCallback::_callback_match", 
-                             G_SCALAR | G_EVAL);
-
-        SPAGAIN;
-
-        if (count != 1) {
-            croak("match callback must return a single value");
-        }
-
-        if (SvTRUE(ERRSV)) {
-            (void) POPs ;
-            croak("input match callback died: %s", SvPV_nolen(ERRSV));
-        }
-
-        res = POPs;
-
-        if (SvTRUE(res)) {
-            results = 1;
-        }
-
-        PUTBACK;
-        FREETMPS;
-        LEAVE;
-    }
-    return results;
-}
-
-void *
-LibXSLT_input_open(char const * filename)
-{
-    SV * results;
-    int count;
-
-    dTHX;
-    dSP;
-
-    ENTER;
-    SAVETMPS;
-
-    PUSHMARK(SP);
-    EXTEND(SP, 1);
-    PUSHs(sv_2mortal(newSVpv((char*)filename, 0)));
-    PUTBACK;
-
-    count = call_pv("XML::LibXML::InputCallback::_callback_open", 
-                              G_SCALAR | G_EVAL);
-
-    SPAGAIN;
-
-    if (count != 1) {
-        croak("open callback must return a single value");
-    }
-
-    if (SvTRUE(ERRSV)) {
-        (void) POPs ;
-        croak("input callback died: %s", SvPV_nolen(ERRSV));
-    }
-
-    results = POPs;
-
-    SvREFCNT_inc(results);
-
-    PUTBACK;
-    FREETMPS;
-    LEAVE;
-
-    return (void *)results;
-}
-
-int
-LibXSLT_input_read(void * context, char * buffer, int len)
-{
-    STRLEN res_len;
-    const char * output;
-    SV * ctxt;
-
-    res_len = 0;
-    ctxt = (SV *)context;
-
-    {
-        int count;
-
-        dTHX;
-        dSP;
-
-        ENTER;
-        SAVETMPS;
-
-        PUSHMARK(SP);
-        EXTEND(SP, 2);
-        PUSHs(ctxt);
-        PUSHs(sv_2mortal(newSViv(len)));
-        PUTBACK;
-
-        count = call_pv("XML::LibXML::InputCallback::_callback_read", 
-                             G_SCALAR | G_EVAL);
-
-        SPAGAIN;
-
-        if (count != 1) {
-            croak("read callback must return a single value");
-        }
-
-        if (SvTRUE(ERRSV)) {
-            (void) POPs ;
-            croak("read callback died: %s", SvPV_nolen(ERRSV));
-        }
-
-        output = POPp;
-        if (output != NULL) {
-            res_len = strlen(output);
-            if (res_len) {
-                strncpy(buffer, output, res_len);
-            }
-            else {
-                buffer[0] = 0;
-            }
-        }
-
-	PUTBACK;
-        FREETMPS;
-        LEAVE;
-    }
-    return res_len;
-}
-
-void
-LibXSLT_input_close(void * context)
-{
-    SV * ctxt;
-
-    ctxt = (SV *)context;
-
-    {
-        dTHX;
-        dSP;
-
-        ENTER;
-        SAVETMPS;
-
-        PUSHMARK(SP);
-        EXTEND(SP, 1);
-        PUSHs(ctxt);
-        PUTBACK;
-
-        call_pv("XML::LibXML::InputCallback::_callback_close", 
-                             G_SCALAR | G_EVAL | G_DISCARD);
-
-        SvREFCNT_dec(ctxt);
-
-        if (SvTRUE(ERRSV)) {
-            croak("close callback died: %s", SvPV_nolen(ERRSV));
-        }
-
-        FREETMPS;
-        LEAVE;
-    }
-}
-
 int
 LibXSLT_security_check(xsltSecurityOption option,
                        xsltSecurityPrefsPtr sec,
@@ -1050,7 +877,7 @@ register_function(self, uri, name, callback)
         STRLEN len;
         char *strkey;
 
-        PERL_UNUSED_VAR(self);        
+        PERL_UNUSED_VAR(self);
         /* todo: Add checking of uri and name in here! */
         xsltRegisterExtModuleFunction((const xmlChar *)name,
                         (const xmlChar *)uri,
@@ -1153,24 +980,6 @@ _parse_stylesheet_file(self, filename)
         RETVAL
 
 void
-lib_init_callbacks( self )
-        SV * self
-    CODE:
-        PERL_UNUSED_VAR(self);
-        xmlRegisterInputCallbacks((xmlInputMatchCallback) LibXSLT_input_match,
-                                  (xmlInputOpenCallback) LibXSLT_input_open,
-                                  (xmlInputReadCallback) LibXSLT_input_read,
-                                  (xmlInputCloseCallback) LibXSLT_input_close);
-
-void
-lib_cleanup_callbacks( self )
-        SV * self
-    CODE:
-        PERL_UNUSED_VAR(self);
-        xmlCleanupInputCallbacks();
-        xmlRegisterDefaultInputCallbacks();
-
-void
 INIT_THREAD_SUPPORT()
     CODE:
        if (x_PROXY_NODE_REGISTRY_MUTEX != NULL) {
@@ -1353,7 +1162,7 @@ transform_file(self, wrapper, filename, ...)
 
 	   xmlFreeDoc( source_dom );
         }
-        
+
         if (real_dom == NULL) {
             LibXSLT_report_error_ctx(saved_error,0);
             croak("Unknown error applying stylesheet");
@@ -1400,7 +1209,7 @@ _output_string(self, sv_doc, bytes_vs_chars=0)
         XSLT_GET_IMPORT_PTR(encoding, self, encoding)
         if (encoding != NULL) {
             encoder = xmlFindCharEncodingHandler((char *)encoding);
-        if ((encoder != NULL) &&
+            if ((encoder != NULL) &&
                  (xmlStrEqual((const xmlChar *)encoder->name,
                               (const xmlChar *) "UTF-8")))
                 encoder = NULL;
@@ -1412,7 +1221,7 @@ _output_string(self, sv_doc, bytes_vs_chars=0)
         else {
             xsltSetGenericDebugFunc(NULL, NULL);
         }
-        output = xmlOutputBufferCreateIO( 
+        output = xmlOutputBufferCreateIO(
             (xmlOutputWriteCallback) LibXSLT_iowrite_scalar,
             (xmlOutputCloseCallback) LibXSLT_ioclose_scalar,
             (void*)results,
@@ -1445,7 +1254,7 @@ output_fh(self, sv_doc, fh)
         XSLT_GET_IMPORT_PTR(encoding, self, encoding)
         if (encoding != NULL) {
             encoder = xmlFindCharEncodingHandler((char *)encoding);
-        if ((encoder != NULL) &&
+            if ((encoder != NULL) &&
                  (xmlStrEqual((const xmlChar *)encoder->name,
                               (const xmlChar *) "UTF-8")))
                 encoder = NULL;
@@ -1457,7 +1266,7 @@ output_fh(self, sv_doc, fh)
         else {
             xsltSetGenericDebugFunc(NULL, NULL);
         }
-        output = xmlOutputBufferCreateIO( 
+        output = xmlOutputBufferCreateIO(
             (xmlOutputWriteCallback) LibXSLT_iowrite_fh,
             (xmlOutputCloseCallback) LibXSLT_ioclose_fh,
             (void*)fh,
@@ -1467,7 +1276,7 @@ output_fh(self, sv_doc, fh)
             croak("output to fh failed");
         }
         xmlOutputBufferClose(output);
-        
+
 void
 output_file(self, sv_doc, filename)
         xsltStylesheetPtr self
@@ -1492,7 +1301,7 @@ media_type(self)
     	xmlChar *method;
     CODE:
     	XSLT_GET_IMPORT_PTR(mediaType, self, mediaType);
-	
+
 	if(mediaType == NULL) {
     	    XSLT_GET_IMPORT_PTR(method, self, method);
             RETVAL = "text/xml";
@@ -1519,7 +1328,7 @@ output_method(self)
     	xmlChar *method;
     CODE:
     	XSLT_GET_IMPORT_PTR(method, self, method)
-	
+
         RETVAL = (char*) method;
         if (RETVAL == NULL) {
             /* read http://www.w3.org/TR/xslt#output and tell me how
@@ -1536,7 +1345,7 @@ output_encoding(self)
     	xmlChar *encoding;
     CODE:
     	XSLT_GET_IMPORT_PTR(encoding, self, encoding)
-	
+
         RETVAL = (char*) encoding;
         if (RETVAL == NULL) {
             RETVAL = "UTF-8";
@@ -21,6 +21,7 @@ example/nonfatal.xsl
 perl-libxml-mm.c
 perl-libxml-mm.h
 ppport.h
+scripts/tag-release.pl
 t/01basic.t
 t/02dromeds.t
 t/03input.t
@@ -37,10 +38,13 @@ t/12import.t
 t/13error.t
 t/14security.t
 t/15misc.t
+t/cpan-changes.t
 t/data/perl-begin-page.xml-grammar-vered.xml
 t/data/vered-xml-to-docbook.xslt
+t/pod.t
 t/rt71345_a.t
 t/rt71345_b.t
+t/style-trailing-space.t
 t/xml-grammar-failures.t
 testcases/default.conf
 typemap
@@ -4,7 +4,7 @@
       "Matt Sergeant"
    ],
    "dynamic_config" : 1,
-   "generated_by" : "ExtUtils::MakeMaker version 6.88, CPAN::Meta::Converter version 2.133380",
+   "generated_by" : "ExtUtils::MakeMaker version 6.94, CPAN::Meta::Converter version 2.140640",
    "license" : [
       "perl_5"
    ],
@@ -34,11 +34,19 @@
          "requires" : {
             "Encode" : "0",
             "XML::LibXML" : "1.70",
+            "perl" : "5.008001",
             "strict" : "0",
             "warnings" : "0"
          }
       }
    },
    "release_status" : "stable",
-   "version" : "1.88"
+   "resources" : {
+      "repository" : {
+         "type" : "hg",
+         "url" : "https://bitbucket.org/shlomif/perl-xml-libxslt",
+         "web" : "https://bitbucket.org/shlomif/perl-xml-libxslt"
+      }
+   },
+   "version" : "1.92"
 }
@@ -7,7 +7,7 @@ build_requires:
 configure_requires:
   ExtUtils::MakeMaker: '0'
 dynamic_config: 1
-generated_by: 'ExtUtils::MakeMaker version 6.88, CPAN::Meta::Converter version 2.133380'
+generated_by: 'ExtUtils::MakeMaker version 6.94, CPAN::Meta::Converter version 2.140640'
 license: perl
 meta-spec:
   url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -20,6 +20,9 @@ no_index:
 requires:
   Encode: '0'
   XML::LibXML: '1.70'
+  perl: '5.008001'
   strict: '0'
   warnings: '0'
-version: '1.88'
+resources:
+  repository: https://bitbucket.org/shlomif/perl-xml-libxslt
+version: '1.92'
@@ -207,9 +207,11 @@ if ($ldflags) {
 # Avoid possible shared library name conflict. On Win32 systems
 # the name of system DLL libxlst.dll clashes with module's LibXSLT.dll.
 # To handle this we are gonna rename module's DLL to LibXSLT.xs.dll.
-if ($::is_Win32) {
-  if ($] eq '5.010000') {
-    print STDERR <<5100BUG;
+if ($::is_Win32)
+{
+    if ($] eq '5.010000')
+    {
+        print STDERR <<'BUG';
 ******************************** !!!WARNING!!! ********************************
 According to the version string you are running a win32 perl 5.10.0 that is
 known to be suffering from dynaloader bug that prevents using non-default
@@ -221,11 +223,14 @@ make the proposed changes you will got during the tests many error popups with
 slightly confusing message about "xsltApplyOneTemplate" function.
 This bug is not present in perl 5.8.* and will be fixed in 5.10.1.
 *******************************************************************************
-5100BUG
-  }
-  else {
-    $config{DLEXT} = 'xs.dll' if ($::is_Win32);
-  }
+BUG
+    }
+    else
+    {
+        # Fix for RT #94516 :
+        # https://rt.cpan.org/Ticket/Display.html?id=94516
+        $config{DLEXT} = 'xs.'.$Config{dlext};
+    }
 }
 
 WriteMakefile(
@@ -242,6 +247,22 @@ WriteMakefile(
         'warnings' => 0,
     },
     'OBJECT'     => '$(O_FILES)',
+    (($ExtUtils::MakeMaker::VERSION >= 6.48)
+        ? (MIN_PERL_VERSION => '5.008001',)
+        : ()
+    ),
+    'META_MERGE' => {
+        'meta-spec' => {
+            'version' => 2,
+        },
+        'resources' => {
+            'repository' => {
+                'type' => 'hg',
+                'url'  => 'https://bitbucket.org/shlomif/perl-xml-libxslt',
+                'web'  => 'https://bitbucket.org/shlomif/perl-xml-libxslt',
+            },
+        },
+    },
     %config,
 );
 
@@ -1,7 +1,7 @@
 This module is a fast XSLT library, based on the GNOME libxslt engine
 that you can find at http://www.xmlsoft.org/XSLT/
 
-Performance is currently about twice that of XML::Sablotron (based on 
+Performance is currently about twice that of XML::Sablotron (based on
 XSLTMark tests converted to Perl).
 
 The libxslt processor is also highly standards compliant
@@ -28,7 +28,7 @@ The Makefile.PL tries to determine the correct compiler and linker
 flags for its library dependencies using pkg-config and
 xslt-config. If this fails, you may override the values like this
 
-  perl Makefile.PL INC="..." LIBS="..." 
+  perl Makefile.PL INC="..." LIBS="..."
 
 where INC contains flags for the compiler (such as -I/some_path/include etc.) and LIBS contains linker flags (such as -L/some_path/lib -llibsomething ...).
 
@@ -53,7 +53,7 @@ As XML::LibXSLT is open source software help and patches are appreciated. If you
 find a bug in the current release, make sure this bug still exists in the
 developer version of XML::LibXSLT. This version can be downloaded from its
 Mercurial repository. The repository can be cloned via:
-    
+
     hg clone ssh://hg@bitbucket.org/shlomif/perl-xml-libxslt
 
 Note this account does not allow direct commits.
@@ -59,11 +59,11 @@ while(my $line = <CONFIG>) {
         push @config, $current;
         $current = {};
     }
-    
+
     # ignore comments and full line comments
     $line =~ s/#.*$//;
     next unless $line =~ /\S/;
-    
+
     if ($line =~ /^\s*\[(.*)\]\s*$/) {
         $current->{component} = $1;
     }
@@ -74,15 +74,15 @@ while(my $line = <CONFIG>) {
 
 for my $driver (@{$options{d}}) {
     my $pkg = "Driver::${driver}";
-    
+
     $pkg->can('init')->(verbose => $options{v});
-    
+
     $pkg->can('chdir')->($basedir);
-    
+
     print "Testing: $driver\n\n";
 
     print_header();
-    
+
     my %totals;
 
     COMPONENT:
@@ -110,14 +110,14 @@ for my $driver (@{$options{d}}) {
                 my $bench = timeit($iter, sub {
                         $pkg->can('run_transform')->($cmp->{output});
                     });
-                
+
                 my $str = timestr($bench, 'all', '5.4f');
-                
+
                 if ($str =~ /\((\d+\.\d+)/) {
                     $ms = $1;
                     $ms *= 1000;
                 }
-                
+
                 $kb_in = (stat($cmp->{input}))[7];
 
                 if ($options{x}) {
@@ -127,7 +127,7 @@ for my $driver (@{$options{d}}) {
                     $kb_in += (stat($cmp->{stylesheet}))[7];
                     $kb_in /= 1024;
                 }
-                
+
                 $kb_in *= $iter;
 
                 $kb_out = (stat($cmp->{output}))[7];
@@ -192,7 +192,7 @@ for my $driver (@{$options{d}}) {
                 warn "$component failed: $@" if $options{v};
                 $result = 'ERROR';
             }
-            
+
             if (($result =~ /OK/) || ($result eq 'NO REFERENCE')) {
                 $totals{iter} += $iter;
                 $totals{ms} += $ms;
@@ -203,18 +203,18 @@ for my $driver (@{$options{d}}) {
             print_output() unless $cmp->{written};
             $cmp->{written}++;
         } # $options{n} loop
-        
+
         delete $cmp->{written};
     } # each component
-    
+
     $pkg->can('shutdown')->();
-    
+
     $component = 'total';
     $iter = $totals{iter};
     $ms = $totals{ms};
     $kb_in = $totals{kb_in};
     $kb_out = $totals{kb_out};
-    $kb_sec = ($kb_in + $kb_out) / 
+    $kb_sec = ($kb_in + $kb_out) /
                 ( $ms / 500 );
     $ref_size = 0;
     $result = '';
@@ -229,23 +229,23 @@ usage: $0 [options]
 
         -c <file>   load configuration from <file>
                     defaults to testcases/default.conf
-                    
+
         -n <num>    run each test case <num> times. Default = 1.
-        
+
         -t          only one iteration per test case (note this
                     is different to -n 1)
-        
+
         -d <Driver> test <Driver>. Use multiple -d options to test
                     more than one driver. Defaults are set in this
                     script (the \@default_drivers variable).
-        
+
         -x          XSLTMark emulation. Infuriatingly XSLTMark thinks
                     there are 1000 bytes in a Kilobyte. Someone please
                     tell them some basic computer science...
-                    
+
                     Without this option, this benchmark also includes
                     the size of the stylesheet in the KB In figure.
-                    
+
         -v          be verbose.
 
 Copyright 2001 AxKit.com Ltd. This is free software, you may use it and
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
 
-<!-- 
+<!--
 	*** Stylesheet to convert Apache "in the news" XML data into the page
 	*** www.apache.org/in_the_news.html
 	***
@@ -34,7 +34,7 @@
 	<P>
 	Since becoming the #1 Web server, Apache has featured in a number
 	of reviews and articles.  If you have seen a story about Apache on
-	the Web or in the press 
+	the Web or in the press
 	<A HREF="mailto:mjc@apache.org">let us know</A>
 	so that we can include it here.
 	</P>
@@ -31,17 +31,17 @@ extern "C" {
 #endif
 
 #ifdef XS_WARNINGS
-#define xs_warn(string) warn(string) 
+#define xs_warn(string) warn(string)
 /* #define xs_warn(string) fprintf(stderr, string) */
 #else
 #define xs_warn(string)
 #endif
 
 /**
- * this is a wrapper function that does the type evaluation for the 
+ * this is a wrapper function that does the type evaluation for the
  * node. this makes the code a little more readable in the .XS
- * 
- * the code is not really portable, but i think we'll avoid some 
+ *
+ * the code is not really portable, but i think we'll avoid some
  * memory leak problems that way.
  **/
 const char*
@@ -51,7 +51,7 @@ x_PmmNodeTypeName( xmlNodePtr elem ){
     if ( elem != NULL ) {
         switch ( elem->type ) {
         case XML_ELEMENT_NODE:
-            name = "XML::LibXML::Element";   
+            name = "XML::LibXML::Element";
             break;
         case XML_TEXT_NODE:
             name = "XML::LibXML::Text";
@@ -63,7 +63,7 @@ x_PmmNodeTypeName( xmlNodePtr elem ){
             name = "XML::LibXML::CDATASection";
             break;
         case XML_ATTRIBUTE_NODE:
-            name = "XML::LibXML::Attr"; 
+            name = "XML::LibXML::Attr";
             break;
         case XML_DOCUMENT_NODE:
         case XML_HTML_DOCUMENT_NODE:
@@ -248,7 +248,7 @@ x_PmmNewNode(xmlNodePtr node)
 }
 
 ProxyNodePtr
-x_PmmNewFragment(xmlDocPtr doc) 
+x_PmmNewFragment(xmlDocPtr doc)
 {
     ProxyNodePtr retval = NULL;
     xmlNodePtr frag = NULL;
@@ -286,7 +286,7 @@ x_PmmNewFragment(xmlDocPtr doc)
  * nodes.
  */
 SV*
-x_PmmNodeToSv( xmlNodePtr node, ProxyNodePtr owner ) 
+x_PmmNodeToSv( xmlNodePtr node, ProxyNodePtr owner )
 {
     ProxyNodePtr dfProxy= NULL;
     SV * retval = &PL_sv_undef;
@@ -302,7 +302,7 @@ x_PmmNodeToSv( xmlNodePtr node, ProxyNodePtr owner )
         xs_warn("x_PmmNodeToSv: return new perl node of class:\n");
         xs_warn( CLASS );
 
-        if ( node->_private != NULL ) { 
+        if ( node->_private != NULL ) {
             dfProxy = x_PmmNewNode(node);
             /* warn(" at 0x%08.8X\n", dfProxy); */
         }
@@ -330,7 +330,7 @@ x_PmmNodeToSv( xmlNodePtr node, ProxyNodePtr owner )
 	if( x_PmmUSEREGISTRY )
 	    x_PmmRegistryREFCNT_inc(dfProxy);
 #endif
-        x_PmmREFCNT_inc(dfProxy); 
+        x_PmmREFCNT_inc(dfProxy);
         /* fprintf(stderr, "REFCNT incremented on node: 0x%08.8X\n", dfProxy); */
 
         switch ( node->type ) {
@@ -361,7 +361,7 @@ x_PmmNodeToSv( xmlNodePtr node, ProxyNodePtr owner )
  */
 
 xmlNodePtr
-x_PmmSvNodeExt( SV* perlnode, int copy ) 
+x_PmmSvNodeExt( SV* perlnode, int copy )
 {
     xmlNodePtr retval = NULL;
     ProxyNodePtr proxy = NULL;
@@ -390,7 +390,7 @@ x_PmmSvNodeExt( SV* perlnode, int copy )
         else if ( sv_derived_from( perlnode, "XML::GDOME::Node" ) ) {
             GdomeNode* gnode = (GdomeNode*)SvIV((SV*)SvRV( perlnode ));
             if ( gnode == NULL ) {
-                warn( "no XML::GDOME data found (datastructure empty)" );    
+                warn( "no XML::GDOME data found (datastructure empty)" );
             }
             else {
                 retval = gdome_xml_n_get_xmlNode( gnode );
@@ -411,7 +411,7 @@ x_PmmSvNodeExt( SV* perlnode, int copy )
 /* extracts the libxml2 owner node from a perl reference
  */
 xmlNodePtr
-x_PmmSvOwner( SV* perlnode ) 
+x_PmmSvOwner( SV* perlnode )
 {
     xmlNodePtr retval = NULL;
     if ( perlnode != NULL
@@ -30,10 +30,10 @@ extern "C" {
 #endif
 
 /*
- * NAME xs_warn 
+ * NAME xs_warn
  * TYPE MACRO
- * 
- * this makro is for XML::LibXML development and debugging. 
+ *
+ * this makro is for XML::LibXML development and debugging.
  *
  * SYNOPSIS
  * xs_warn("my warning")
@@ -41,12 +41,12 @@ extern "C" {
  * this makro takes only a single string(!) and passes it to perls
  * warn function if the XS_WARNRINGS pragma is used at compile time
  * otherwise any xs_warn call is ignored.
- * 
+ *
  * pay attention, that xs_warn does not implement a complete wrapper
  * for warn!!
  */
 #ifdef XS_WARNINGS
-#define xs_warn(string) warn("%s",string) 
+#define xs_warn(string) warn("%s",string)
 #else
 #define xs_warn(string)
 #endif
@@ -146,7 +146,7 @@ void
 x_PmmFixProxyEncoding( ProxyNodePtr dfProxy );
 
 /* x_PmmSvNodeExt
- * TYPE 
+ * TYPE
  *    Function
  * PARAMETER
  *    @perlnode: the perl reference that holds the scalar.
@@ -154,12 +154,12 @@ x_PmmFixProxyEncoding( ProxyNodePtr dfProxy );
  *
  * DESCRIPTION
  *
- * The function recognizes XML::LibXML and XML::GDOME 
+ * The function recognizes XML::LibXML and XML::GDOME
  * nodes as valid input data. The second parameter 'copy'
  * indicates if in case of GDOME nodes the libxml2 node
- * should be copied. In some cases, where the node is 
+ * should be copied. In some cases, where the node is
  * cloned anyways, this flag has to be set to '0', while
- * the default value should be allways '1'. 
+ * the default value should be allways '1'.
  */
 xmlNodePtr
 x_PmmSvNodeExt( SV * perlnode, int copy );
@@ -208,7 +208,7 @@ x_PmmSvContext( SV * perlctxt );
  *
  * DESCRIPTION
  * This function implements a nodetype independant node cloning.
- * 
+ *
  * Note that this function has to stay in this module, since
  * XML::LibXSLT reuses it.
  */
@@ -227,7 +227,7 @@ x_PmmCloneNode( xmlNodePtr node , int deep );
  *
  * the function will only work, if XML::LibXML is compiled with
  * XML::GDOME support.
- *    
+ *
  */
 SV *
 x_PmmNodeToGdomeSv( xmlNodePtr node );
@@ -235,7 +235,7 @@ x_PmmNodeToGdomeSv( xmlNodePtr node );
 /**
  * NAME x_PmmNodeTypeName
  * TYPE function
- * 
+ *
  * returns the perl class name for the given node
  *
  * SYNOPSIS
@@ -257,7 +257,7 @@ x_PmmDecodeString( const char *encoding, const xmlChar *string);
  * TYPE function
  * SYNOPSIS
  * SV *my_sv = c_string_to_sv( "my string", encoding );
- * 
+ *
  * this function converts a libxml2 string to a SV*. although the
  * string is copied, the func does not free the c-string for you!
  *
@@ -273,7 +273,7 @@ C2Sv( const xmlChar *string, const xmlChar *encoding );
  * TYPE function
  * SYNOPSIS
  * SV *my_sv = sv_to_c_string( my_sv, encoding );
- * 
+ *
  * this function converts a SV* to a libxml string. the SV-value will
  * be copied into a *newly* allocated string. (don't forget to free it!)
  *
@@ -0,0 +1,27 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use IO::All;
+
+my ($version) =
+    (map { m{\$VERSION *= *'([^']+)'} ? ($1) : () }
+    io->file('LibXSLT.pm')->getlines()
+    )
+    ;
+
+if (!defined ($version))
+{
+    die "Version is undefined!";
+}
+
+my @cmd = (
+    "hg", "tag", "-m",
+    "Tagging the XML-LibXSLT release as $version",
+    "XML-LibXSLT-$version",
+);
+
+print join(" ", map { /\s/ ? qq{"$_"} : $_ } @cmd), "\n";
+exec(@cmd);
+
@@ -1,8 +1,8 @@
 use strict;
 use warnings;
 
-# Should be 25.
-use Test::More tests => 25;
+# Should be 28.
+use Test::More tests => 28;
 use XML::LibXSLT;
 use XML::LibXML 1.59;
 
@@ -51,7 +51,7 @@ $icb->register_callbacks( [ \&match_cb, \&open_cb,
                             \&read_cb, \&close_cb ] );
 
 $xslt->input_callbacks($icb);
-                
+
 my $stylesheet = $xslt->parse_stylesheet($parser->parse_string($stylsheetstring));
 # stylesheet
 # TEST
@@ -97,36 +97,38 @@ $stylesheet = undef;
 $xslt = XML::LibXSLT->new();
 $stylesheet = $xslt->parse_stylesheet($parser->parse_string($stylsheetstring));
 
-# setting callbacks
-local $XML::LibXML::match_cb = \&match_cb;
-local $XML::LibXML::open_cb = \&open_cb;
-local $XML::LibXML::close_cb = \&close_cb;
-local $XML::LibXML::read_cb = \&read_cb;
-
-# warn "transform!\n";
-$results = $stylesheet->transform($doc);
-
-# results
-# TEST
-ok ($results, 'results is OK - 2.');
+{
+    # setting callbacks
+    local $XML::LibXML::match_cb = \&match_cb;
+    local $XML::LibXML::open_cb = \&open_cb;
+    local $XML::LibXML::close_cb = \&close_cb;
+    local $XML::LibXML::read_cb = \&read_cb;
 
-$output = $stylesheet->output_string($results);
+    # warn "transform!\n";
+    $results = $stylesheet->transform($doc);
 
-# warn "output: $output\n";
-# output
-# TEST
-ok ($output, 'output is OK - 2.');
+    # results
+    # TEST
+    ok ($results, 'results is OK - 2.');
 
-$XML::LibXML::open_cb = \&dying_open_cb;
+    $output = $stylesheet->output_string($results);
 
-# check if the transform throws an exception
-eval {
-    $stylesheet->transform($doc);
-};
-{
-    my $E = $@;
+    # warn "output: $output\n";
+    # output
     # TEST
-    ok ($E, "Transform Threw: $E");
+    ok ($output, 'output is OK - 2.');
+
+    $XML::LibXML::open_cb = \&dying_open_cb;
+
+    # check if the transform throws an exception
+    eval {
+        $stylesheet->transform($doc);
+    };
+    {
+        my $E = $@;
+        # TEST
+        ok ($E, "Transform Threw: $E");
+    }
 }
 
 #
@@ -172,6 +174,50 @@ $stylesheet = $xslt->parse_stylesheet($parser->parse_string($stylsheetstring));
 ok ($stylesheet, 'stylesheet is OK - 2.');
 
 #
+# Test not matching callback
+# This also verifies that all the previous callbacks were unregistered.
+#
+
+$xslt = undef;
+$stylesheet = undef;
+$icb = undef;
+
+$xslt = XML::LibXSLT->new();
+$icb = XML::LibXML::InputCallback->new();
+
+# registering callbacks
+$icb->register_callbacks( [ \&match_cb, \&stylesheet_open_cb,
+                            \&read_cb, \&close_cb ] );
+
+$xslt->input_callbacks($icb);
+
+my $no_match_count = 0;
+
+$stylsheetstring = <<'EOT';
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+    <xsl:template match="/">
+        <result>
+            <xsl:apply-templates select="document('not-found.xml')/*"/>
+        </result>
+    </xsl:template>
+</xsl:stylesheet>
+EOT
+
+$stylesheet = $xslt->parse_stylesheet($parser->parse_string($stylsheetstring));
+# stylesheet
+# TEST
+ok ($stylesheet, 'stylesheet is OK - 3.');
+
+$results = $stylesheet->transform($doc);
+# results
+# TEST
+ok ($results, 'results is OK - 3.');
+
+# no_match_count
+# TEST
+is ($no_match_count, 1, 'match_cb called once if no match');
+
+#
 # input callback functions
 #
 
@@ -183,6 +229,10 @@ sub match_cb {
         ok(1, 'URI is OK in match_cb.');
         return 1;
     }
+    if ($uri eq "not-found.xml") {
+        ++$no_match_count;
+        return 0;
+    }
     return 0;
 }
 
@@ -17,9 +17,9 @@ my $source = $parser->parse_string(<<'EOF');
 <bottom myid="last">LAST</bottom>
 </top>
 EOF
-        
+
 # TEST
-        
+
 ok($source, ' TODO : Add test name');
 
 my $style_doc = $parser->parse_string(<<'EOF');
@@ -151,19 +151,19 @@ EOF
 # TEST:$num_style_docs=$n;
 while (@style_docs) {
     my ($media_type, $style_str) = splice(@style_docs, 0, 2);
-    
+
     my $style_doc = $parser->parse_string($style_str);
     # TEST*$num_style_docs
     ok($style_doc, ' TODO : Add test name');
-    
+
     my $stylesheet = $xslt->parse_stylesheet($style_doc);
     # TEST*$num_style_docs
     ok($stylesheet, ' TODO : Add test name');
-    
+
     my $results = $stylesheet->transform($source);
     # TEST*$num_style_docs
     ok($results, ' TODO : Add test name');
-    
+
     # TEST*$num_style_docs
     is($stylesheet->media_type, $media_type, ' TODO : Add test name');
 }
@@ -26,7 +26,7 @@ EOT
 my $foodoc = <<'EOT';
 <?xml version="1.0" encoding="ISO-8859-1"?>
 
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 xmlns:data="data.uri" version="1.0">
 <xsl:output encoding="ISO-8859-1" method="text"/>
 
@@ -54,7 +54,7 @@ my $results = $stylesheet->transform($source);
 # TEST
 ok ($results, 'Results are true.');
 # TEST
-like ($results->toString, qr/typed data in stylesheet/, 
+like ($results->toString, qr/typed data in stylesheet/,
     'found "typed data in stylesheet"');
 
 ###############################################################
@@ -1,44 +1,44 @@
 use strict;
 use warnings;
 
-# Should be 38.
-use Test::More tests => 38;
+# Should be 39.
+use Test::More tests => 39;
 use XML::LibXSLT;
 
 {
   my $parser = XML::LibXML->new();
   my $xslt = XML::LibXSLT->new();
   # TEST
-  ok($parser, '$parser was initted'); 
+  ok($parser, '$parser was initted');
   # TEST
   ok($xslt, '$xslt was initted');
-  
-  $xslt->register_function('urn:foo' => 'test', sub { 
+
+  $xslt->register_function('urn:foo' => 'test', sub {
           # TEST*4
-          ok(1, 'urn:foo was reached.'); 
+          ok(1, 'urn:foo was reached.');
           return $_[1] ?  ($_[0] . $_[1]) : $_[0];
       }
   );
-  $xslt->register_function('urn:foo' => 'test2', sub { 
+  $xslt->register_function('urn:foo' => 'test2', sub {
           # TEST*2
-          is(ref($_[0]), 'XML::LibXML::NodeList', 'First argument is a NodeList'); 
-          ref($_[0]) 
+          is(ref($_[0]), 'XML::LibXML::NodeList', 'First argument is a NodeList');
+          ref($_[0])
       }
   );
-  $xslt->register_function('urn:foo' => 'test3', sub { 
+  $xslt->register_function('urn:foo' => 'test3', sub {
           # TEST*2
-          is(scalar(@_), 0, 'No arguments were received.'); 
-          return; 
+          is(scalar(@_), 0, 'No arguments were received.');
+          return;
       }
   );
-  
+
   my $source = $parser->parse_string(<<'EOT');
 <?xml version="1.0" encoding="ISO-8859-1"?>
 <document></document>
 EOT
 
   my $style = $parser->parse_string(<<'EOT');
-<xsl:stylesheet 
+<xsl:stylesheet
     version="1.0"
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
     xmlns:foo="urn:foo"
@@ -50,7 +50,7 @@ EOT
   (( <xsl:value-of select="foo:test('Foo', '!')"/> ))
   (( <xsl:value-of select="foo:test('Foo', '!')"/> ))
        <!-- this works -->
-     <xsl:value-of select="foo:test(string($FOO))"/>   
+     <xsl:value-of select="foo:test(string($FOO))"/>
        <!-- this only works in 1.52 -->
      <xsl:value-of select="foo:test($FOO)"/>
   [[ <xsl:value-of select="foo:test2(/*)"/> ]]
@@ -110,14 +110,14 @@ EOT
     # TEST*$n
     ok($results, '$results is true - 2 (' . $n . ')');
     # TEST*$n
-    like($stylesheet->output_string($results), 
-        qr(<li>one</li>), 
+    like($stylesheet->output_string($results),
+        qr(<li>one</li>),
         'Matches li-one - ' . $n
     );
     # TEST*$n
     like (
-        $stylesheet->output_string($results), 
-        qr(<li>one</li><li>two</li><li>three</li>), 
+        $stylesheet->output_string($results),
+        qr(<li>one</li><li>two</li><li>three</li>),
         'Output matches multiple lis - ' . $n
     );
   }
@@ -166,7 +166,7 @@ XML
     my $expect = qq(<html xmlns:foo="http://foo"><head><foo>1st</foo><foo>2nd</foo></head></html>\n);
     # TEST
     like ($result->serialize,
-        qr{(\Q<?xml version="1.0"?>\n\E)?\Q$expect\E}, 
+        qr{(\Q<?xml version="1.0"?>\n\E)?\Q$expect\E},
         'Results serialize matches text.'
     );
   }
@@ -209,7 +209,7 @@ XSLT
 XML
   # TEST
   is ($result->serialize,
-      qq(<?xml version="1.0"?>\n<out><b><b/></b><b><c/></b></out>\n), 
+      qq(<?xml version="1.0"?>\n<out><b><b/></b><b><c/></b></out>\n),
       'result is right.'
   );
 }
@@ -239,7 +239,7 @@ XML
   my $xsltdoc = $p->parse_string(<<'EOF');
 <?xml version="1.0" encoding="utf-8"?>
 <xsl:stylesheet version="1.0"
-     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"  
+     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:x="http://x/x"
 >
 
@@ -281,7 +281,7 @@ EOF
   # TEST
   ok ($val, 'val is true.');
   # TEST
-  is ($val, "foo,barzzz,bak,bar;foo,barzzz,bak,bar;barbakzzz", 
+  is ($val, "foo,barzzz,bak,bar;foo,barzzz,bak,bar;barbakzzz",
       'val has the right value.')
     or print $stylesheet->output_as_bytes($result);
 
@@ -296,7 +296,7 @@ EOF
   my $xsltdoc = $p->parse_string(<<EOF);
 <?xml version="1.0" encoding="utf-8"?>
 <xsl:stylesheet version="1.0"
-     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"  
+     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:foo="$ns"
 >
 
@@ -330,7 +330,7 @@ EOF
   my $xsltdoc = $p->parse_string(<<EOF);
 <?xml version="1.0" encoding="utf-8"?>
 <xsl:stylesheet version="1.0"
-     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"  
+     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:foo="$ns"
 	 extension-element-prefixes="foo"
 >
@@ -358,5 +358,56 @@ EOF
   is ($val, 10, "contextual register_element");
 }
 
+{
+    # GNOME Bugzilla bug #562302
+    my $parser = new XML::LibXML;
+    my $xslt = new XML::LibXSLT;
+
+    # registering function
+    XML::LibXSLT->register_function("urn:perl", 'cfg', sub {
+        return $parser->parse_string('<xml_storage/>');
+    });
+
+    # loading and parsing stylesheet
+    my $style_doc = $parser->parse_string(<<'EOF');
+<xsl:stylesheet version="1.0"
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:exslt="http://exslt.org/common"
+    xmlns:perl="urn:perl"
+    exclude-result-prefixes="exslt perl">
+
+<xsl:variable name="xml_storage" select="perl:cfg()/xml_storage" />
+
+<xsl:variable name="page-data-tree">
+    <title><xsl:value-of select="$xml_storage"/></title>
+    <crumbs>
+        <page><url>hello</url></page>
+        <page><url>bye</url></page>
+    </crumbs>
+</xsl:variable>
+<xsl:variable name="page-data" select="exslt:node-set($page-data-tree)" />
+
+<xsl:template match="/">
+    <result><xsl:copy-of select="$xml_storage"/></result>
+</xsl:template>
+
+</xsl:stylesheet>
+EOF
+
+    my $stylesheet = $xslt->parse_stylesheet($style_doc);
+
+    # performing transform
+    my $source = XML::LibXML::Document->new;
+    my $results = $stylesheet->transform($source);
+
+    my $string = $stylesheet->output_string($results);
+    my $expected = <<'EOF';
+<?xml version="1.0"?>
+<result><xml_storage/></result>
+EOF
+    # TEST
+    is ($string, $expected, 'GNOME Bugzilla bug #562302');
+}
+
 # TEST
 ok(1, 'Reached here.');
@@ -95,7 +95,7 @@ XSLT
   # TEST
   ok( $results, ' TODO : Add test name' );
 
-  my $output = $stylesheet->output_string( $results );  
+  my $output = $stylesheet->output_string( $results );
   # TEST
   ok( !Encode::is_utf8($output), ' TODO : Add test name' );
   # TEST
@@ -7,7 +7,7 @@ use Test::More tests => 6;
 
 use vars (qw($loaded));
 
-END { 
+END {
     # TEST
     ok($loaded, 'Everything was properly loaded.');
 }
@@ -145,8 +145,8 @@ my $E = $@;
 ok( $E, ' TODO : Add test name' );
 
 # TEST
-like ( $E, 
-    qr/unregistered variable foo|variable 'foo' has not been declared/i, 
+like ( $E,
+    qr/unregistered variable foo|variable 'foo' has not been declared/i,
     'Exception matches.' );
 # TEST
 like ( $E, qr/element value-of/, 'Exception matches "element value-of"' );
@@ -206,7 +206,7 @@ print "# net read denied\n";
 {
     my $E = $@;
 # TEST
-like($E, qr|read for http://localhost/deny\.xml refused|, 
+like($E, qr|read for http://localhost/deny\.xml refused|,
     'Exception read for refused.'
 );
 }
@@ -224,7 +224,7 @@ like($E, qr|read for http://localhost/deny\.xml refused|,
     # We need to go to additional lengths to reserve a port due to:
     # - https://rt.cpan.org/Ticket/Display.html?id=71456
     # - http://stackoverflow.com/questions/7704228/perl-how-to-portably-reserve-a-tcp-port-so-there-will-be-a-non-available-url
- 
+
 my $listen_sock = IO::Socket::INET->new(
     Listen => 1,
     Proto => 'tcp',
@@ -251,7 +251,7 @@ print "# net write allowed\n";
 {
     my $E = $@;
 # TEST
-like ($E, qr/unable to save to \Q$file\E/, 
+like ($E, qr/unable to save to \Q$file\E/,
     'unable to save excpetion');
 }
 }
@@ -286,7 +286,7 @@ eval {
 {
     my $E = $@;
 # TEST
-like ($E, qr/Test die from security callback/, 
+like ($E, qr/Test die from security callback/,
     'Exception Test die from security callback.');
 
 }
@@ -0,0 +1,12 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Test::More;
+
+eval 'use Test::CPAN::Changes 0.27';
+plan skip_all => 'Test::CPAN::Changes required for this test' if $@;
+
+changes_ok();
+
@@ -0,0 +1,6 @@
+#!perl -T
+
+use Test::More;
+eval "use Test::Pod 1.14";
+plan skip_all => "Test::Pod 1.14 required for testing POD" if $@;
+all_pod_files_ok();
@@ -18,7 +18,7 @@ my $stylesheet = $xslt->parse_stylesheet(XML::LibXML->load_xml(string => <<'EOF'
 <xsl:stylesheet version="1.0"
                 extension-element-prefixes="exsl local"
                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-                xmlns:exsl="http://exslt.org/common" 
+                xmlns:exsl="http://exslt.org/common"
                 xmlns:local="urn:local">
   <xsl:template match="/">
     <xsl:variable name="foo"><foo a="foo"/></xsl:variable>
@@ -17,7 +17,7 @@ my $stylesheet = $xslt->parse_stylesheet(XML::LibXML->load_xml(string => <<'EOF'
 <xsl:stylesheet version="1.0"
                 extension-element-prefixes="exsl local"
                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-                xmlns:exsl="http://exslt.org/common" 
+                xmlns:exsl="http://exslt.org/common"
                 xmlns:local="urn:local">
   <xsl:template match="/">
     <xsl:variable name="foo"><foo a="foo"/></xsl:variable>
@@ -0,0 +1,30 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Test::More;
+
+eval "use Test::TrailingSpace";
+if ($@)
+{
+   plan skip_all => "Test::TrailingSpace required for trailing space test.";
+}
+else
+{
+   plan tests => 1;
+}
+
+# TODO: add .pod, .PL, the README/Changes/TODO/etc. documents and possibly
+# some other stuff.
+my $finder = Test::TrailingSpace->new(
+   {
+       root => '.',
+       filename_regex => qr/(?:\.(?:t|pm|pl|xs|c|h|txt|pod|PL)|README|Changes|TODO|LICENSE)\z/,
+   },
+);
+
+# TEST
+$finder->no_trailing_space(
+   "No trailing space was found."
+);