r46086 - in /branches/upstream/libxml-libxslt-perl/current: Changes LibXSLT.pm LibXSLT.xs MANIFEST META.yml Makefile.PL README perl-libxml-mm.c perl-libxml-mm.h t/10functions.t t/15misc.t
gregoa at users.alioth.debian.org
gregoa at users.alioth.debian.org
Mon Oct 19 16:23:46 UTC 2009
Author: gregoa
Date: Mon Oct 19 16:23:42 2009
New Revision: 46086
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=46086
Log:
[svn-upgrade] Integrating new upstream version, libxml-libxslt-perl (1.70)
Added:
branches/upstream/libxml-libxslt-perl/current/t/15misc.t
Modified:
branches/upstream/libxml-libxslt-perl/current/Changes
branches/upstream/libxml-libxslt-perl/current/LibXSLT.pm
branches/upstream/libxml-libxslt-perl/current/LibXSLT.xs
branches/upstream/libxml-libxslt-perl/current/MANIFEST
branches/upstream/libxml-libxslt-perl/current/META.yml
branches/upstream/libxml-libxslt-perl/current/Makefile.PL
branches/upstream/libxml-libxslt-perl/current/README
branches/upstream/libxml-libxslt-perl/current/perl-libxml-mm.c
branches/upstream/libxml-libxslt-perl/current/perl-libxml-mm.h
branches/upstream/libxml-libxslt-perl/current/t/10functions.t
Modified: branches/upstream/libxml-libxslt-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-libxslt-perl/current/Changes?rev=46086&op=diff
==============================================================================
--- branches/upstream/libxml-libxslt-perl/current/Changes (original)
+++ branches/upstream/libxml-libxslt-perl/current/Changes Mon Oct 19 16:23:42 2009
@@ -1,6 +1,16 @@
Revision history for Perl extension XML::LibXSLT.
-1.68pre
+1.70
+ - fixed various bugs
+ - documentation updates
+ - #48247: Win32 patch kindly provided by KMX at cpan.org
+ - sync with latest XML::LibXML ABI and add a compatibility check
+ - do not force -lgcrypt and -lgpg-error linker flags
+ - fix for attribute nodes returned by user-defined XPath functions
+ - address #41542: restore internalDTD subset on the source
+ document of a transformation (libxslt unlinks it)
+
+1.68
- fix compilation problems
- skip exslt tests if not available
- added XML::LibXSLT::HAVE_EXSLT() (1/0)
Modified: branches/upstream/libxml-libxslt-perl/current/LibXSLT.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-libxslt-perl/current/LibXSLT.pm?rev=46086&op=diff
==============================================================================
--- branches/upstream/libxml-libxslt-perl/current/LibXSLT.pm (original)
+++ branches/upstream/libxml-libxslt-perl/current/LibXSLT.pm Mon Oct 19 16:23:42 2009
@@ -1,25 +1,39 @@
-# $Id: LibXSLT.pm 214 2008-11-05 13:24:52Z pajas $
+# $Id: LibXSLT.pm 228 2009-10-07 12:25:23Z pajas $
+#
+# This is free software, you may use it and distribute it under the same terms as
+# Perl itself.
+#
+# Copyright 2001-2009 AxKit.com Ltd.
+#
+#
package XML::LibXSLT;
use strict;
use vars qw($VERSION @ISA $USE_LIBXML_DATA_TYPES $MatchCB $ReadCB $OpenCB $CloseCB);
-use XML::LibXML 1.67;
+sub REQUIRE_XML_LIBXML_ABI_VERSION { 2 }
+
+use XML::LibXML 1.70;
use XML::LibXML::Literal;
use XML::LibXML::Boolean;
use XML::LibXML::Number;
use XML::LibXML::NodeList;
+
BEGIN {
use Carp;
require Exporter;
-$VERSION = "1.68";
+$VERSION = "1.70";
require DynaLoader;
@ISA = qw(DynaLoader);
+
+# avoid possible shared library name conflict on Win32
+# not using this trick on 5.10.0 (suffering from DynaLoader bug)
+local $DynaLoader::dl_dlext = "xs.$DynaLoader::dl_dlext" if (($^O eq 'MSWin32') && ($] ne '5.010000'));
bootstrap XML::LibXSLT $VERSION;
@@ -28,6 +42,7 @@
INIT_THREAD_SUPPORT() if XML::LibXML::threads_shared_enabled();
$USE_LIBXML_DATA_TYPES = 0;
}
+
sub new {
my $class = shift;
@@ -595,17 +610,16 @@
use XML::LibXSLT;
use XML::LibXML;
- my $parser = XML::LibXML->new();
my $xslt = XML::LibXSLT->new();
- my $source = $parser->parse_file('foo.xml');
- my $style_doc = $parser->parse_file('bar.xsl');
+ my $source = XML::LibXML->load_xml(location => 'foo.xml');
+ my $style_doc = XML::LibXML->load_xml(location=>'bar.xsl', no_cdata=>1);
my $stylesheet = $xslt->parse_stylesheet($style_doc);
my $results = $stylesheet->transform($source);
- print $stylesheet->output_string($results);
+ print $stylesheet->output_as_bytes($results);
=head1 DESCRIPTION
@@ -681,14 +695,20 @@
=over
-=item parse_stylesheet($doc)
-
-C<$doc> here is an XML::LibXML::Document object (see L<XML::LibXML>)
+=item parse_stylesheet($stylesheet_doc)
+
+C<$stylesheet_doc> here is an XML::LibXML::Document object (see L<XML::LibXML>)
representing an XSLT file. This method will return a
XML::LibXSLT::Stylesheet object, or undef on failure. If the XSLT is
invalid, an exception will be thrown, so wrap the call to
parse_stylesheet in an eval{} block to trap this.
+IMPORTANT: C<$stylesheet_doc> should not contain CDATA sections,
+otherwise libxslt may misbehave. The best way to assure this is to
+load the stylesheet with no_cdata flag, e.g.
+
+ my $stylesheet_doc = XML::LibXML->load_xml(location=>"some.xsl", no_cdata=>1);
+
=item parse_stylesheet_file($filename)
Exactly the same as the above, but parses the given filename directly.
@@ -722,38 +742,41 @@
=item transform(doc, %params)
my $results = $stylesheet->transform($doc, foo => "value);
+ print $stylesheet->output_as_bytes($results);
Transforms the passed in XML::LibXML::Document object, and returns a
new XML::LibXML::Document. Extra hash entries are used as parameters.
+See output_string
=item transform_file(filename, %params)
my $results = $stylesheet->transform_file($filename, bar => "value");
-=item output_string(result)
+=item output_as_bytes(result)
Returns a scalar that is the XSLT rendering of the
XML::LibXML::Document object using the desired output format
(specified in the xsl:output tag in the stylesheet). Note that you can
also call $result->toString, but that will *always* output the
document in XML format which may not be what you asked for in the
-xsl:output tag.
-
-Important note: The string returned by this function appears to Perl
-as characters if the output encoding was specified as UTF-8 and as
-bytes if no output encoding was specified or if the output encoding
-was different from UTF-8. See also C<output_as_bytes(result)> and
-C<output_as_chars(result)>.
-
-=item output_as_bytes(result)
-
-Like C<output_string(result)>, but always return the output as a byte
-string encoded in the output encoding specified in the stylesheet.
+xsl:output tag. The scalar is a byte string encoded in the output
+encoding specified in the stylesheet.
=item output_as_chars(result)
-Like C<output_string(result)>, but always return the output as (UTF-8
+Like C<output_as_bytes(result)>, but always return the output as (UTF-8
encoded) string of characters.
+
+=item output_string(result)
+
+DEPRECATED: This method is something between
+C<output_as_bytes(result)> and C<output_as_bytes(result)>: The scalar
+returned by this function appears to Perl as characters (UTF8 flag is
+on) if the output encoding specified in the XSLT stylesheet was UTF-8
+and as bytes if no output encoding was specified or if the output
+encoding was other than UTF-8. Since the behavior of this function
+depends on the particular stylesheet, it is deprecated in favor of
+C<output_as_bytes(result)> and C<output_as_chars(result)>.
=item output_fh(result, fh)
@@ -955,14 +978,19 @@
=back
+=head1 LICENSE
+
+This is free software, you may use it and distribute it under the same terms as
+Perl itself.
+
+Copyright 2001-2009, AxKit.com Ltd.
+
=head1 AUTHOR
Matt Sergeant, matt at sergeant.org
Security callbacks implementation contributed by Shane Corgatelli.
-Copyright 2001-2008, AxKit.com Ltd. All rights reserved.
-
=head1 MAINTAINER
Petr Pajas , pajas at matfyz.org
Modified: branches/upstream/libxml-libxslt-perl/current/LibXSLT.xs
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-libxslt-perl/current/LibXSLT.xs?rev=46086&op=diff
==============================================================================
--- branches/upstream/libxml-libxslt-perl/current/LibXSLT.xs (original)
+++ branches/upstream/libxml-libxslt-perl/current/LibXSLT.xs Mon Oct 19 16:23:42 2009
@@ -1,4 +1,10 @@
-/* $Id: LibXSLT.xs 214 2008-11-05 13:24:52Z pajas $ */
+/* $Id: LibXSLT.xs 224 2009-09-25 09:02:20Z pajas $ */
+/*
+ * This is free software, you may use it and distribute it under the same terms as
+ * Perl itself.
+ *
+ * Copyright 2001-2009 AxKit.com Ltd.
+*/
#ifdef __cplusplus
extern "C" {
@@ -230,12 +236,12 @@
double tmp_double;
int tmp_int;
AV * array_result;
- xmlNodePtr tmp_node, tmp_node1, tmp_node2;
+ xmlNodePtr tmp_node, tmp_node1, tmp_node2 = NULL;
SV *key;
char *strkey;
const char *function, *uri;
SV **perl_function;
- xmlDocPtr container;
+ xmlDocPtr container = NULL;
xsltTransformContextPtr tctxt = xsltXPathGetTransformContext(ctxt);
dSP;
@@ -270,8 +276,8 @@
if ( nodelist->nodeNr > 0 ) {
int i = 0 ;
const char * cls = "XML::LibXML::Node";
- xmlNodePtr tnode;
- SV * element;
+ xmlNodePtr tnode = NULL;
+ SV * element = NULL;
len = nodelist->nodeNr;
for( ; i < len; i++ ){
tnode = nodelist->nodeTab[i];
@@ -283,9 +289,15 @@
(void *)xmlCopyNamespace((xmlNsPtr)tnode)
);
} else {
- /* need to copy the node as libxml2 will free it */
- xmlNodePtr tnode_cpy = xmlCopyNode(tnode, 1);
- element = x_PmmNodeToSv(tnode_cpy, NULL);
+ /* need to copy the node as libxml2 will free it */
+ xmlNodePtr tnode_cpy = xmlCopyNode(tnode, 1);
+ if( tnode_cpy != NULL) {
+ ProxyNodePtr owner = NULL;
+ if ( tnode_cpy != NULL && tnode_cpy->doc != NULL) {
+ owner = x_PmmOWNERPO(x_PmmNewNode(INT2PTR(xmlNodePtr,tnode_cpy->doc)));
+ }
+ element = x_PmmNodeToSv(tnode_cpy, owner);
+ }
}
XPUSHs( sv_2mortal(element) );
}
@@ -343,32 +355,34 @@
if (tctxt == NULL) {
croak("LibXSLT: perl-dispatcher: internal error tctxt == NULL\n");
}
- container = xsltCreateRVT(tctxt);
- if (container == NULL) {
- croak("LibXSLT: perl-dispatcher: cannot create container RVT\n");
- }
- xsltRegisterLocalRVT(tctxt,container);
ret = xmlXPathNewNodeSet(NULL);
ret->boolval = 0;
array_result = (AV*)SvRV(perl_result);
while (av_len(array_result) >= 0) {
tmp_node1 = (xmlNodePtr)x_PmmSvNode(sv_2mortal(av_shift(array_result)));
if (tmp_node1) {
- if (ctxt->context->doc == tmp_node1->doc) {
- /* special case: no copy */
- xmlXPathNodeSetAdd(ret->nodesetval, tmp_node1);
- } else {
- tmp_node = xmlDocCopyNode(tmp_node1, container, 1);
- /* a wraper element is needed to prevent libxml2 from merging adjacent text nodes */
- tmp_node2 = xmlNewDocNode(container,NULL,(xmlChar*) "x",NULL);
- xmlAddChild((xmlNodePtr)container,tmp_node2);
- xmlAddChild(tmp_node2,tmp_node);
- xmlXPathNodeSetAdd(ret->nodesetval, tmp_node);
+ container = xsltCreateRVT(tctxt);
+ if (container == NULL) {
+ if (container == NULL) {
+ croak("LibXSLT: perl-dispatcher: cannot create container RVT\n");
+ }
+#if LIBXSLT_VERSION < 10118
+ xsltRegisterTmpRVT(tctxt,container);
+#else
+ 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 */
+ tmp_node2 = xmlNewDocNode(container,NULL,(xmlChar*) "x",NULL);
+ xmlAddChild((xmlNodePtr)container,tmp_node2);
+ xmlAddChild(tmp_node2,tmp_node);
+ xmlXPathNodeSetAdd(ret->nodesetval, tmp_node);
} else {
croak("LibXSLT: perl-dispatcher returned nodelist with non-node elements\n");
}
- }
+ }
goto FINISH;
}
else if (sv_derived_from(perl_result, "XML::LibXML::Node")) {
@@ -376,10 +390,6 @@
ret = (xmlXPathObjectPtr)xmlXPathNewNodeSet(NULL);
ret->boolval = 0;
if (tmp_node1) {
- if (ctxt->context->doc == tmp_node1->doc) {
- /* special case: no copy */
- xmlXPathNodeSetAdd(ret->nodesetval, tmp_node1);
- } else {
if (tctxt == NULL) {
croak("LibXSLT: perl-dispatcher: internal error tctxt == NULL\n");
}
@@ -387,11 +397,24 @@
if (container == NULL) {
croak("LibXSLT: perl-dispatcher: cannot create container RVT\n");
}
- xsltRegisterLocalRVT(tctxt,container);
+#if LIBXSLT_VERSION < 10118
+ xsltRegisterTmpRVT(tctxt,container);
+#else
+ xsltRegisterLocalRVT(tctxt,container);
+#endif
tmp_node = xmlDocCopyNode(tmp_node1, container, 1);
- xmlAddChild((xmlNodePtr)container,tmp_node);
+ if (tmp_node == NULL) {
+ croak("LibXSLT: perl-dispatcher: cannot copy node for RVT\n");
+ }
+ if (tmp_node->type != XML_ELEMENT_NODE) {
+ /* create a wrapper element */
+ tmp_node2 = xmlNewDocNode(container,NULL,(xmlChar*) "x",NULL);
+ xmlAddChild((xmlNodePtr)container,tmp_node2);
+ xmlAddChild(tmp_node2,tmp_node);
+ } else {
+ xmlAddChild((xmlNodePtr)container,tmp_node);
+ }
xmlXPathNodeSetAdd(ret->nodesetval,tmp_node);
- }
} else {
croak("LibXSLT: perl-dispatcher returned a null XML::LibXML::Node object\n");
}
@@ -416,12 +439,12 @@
ret = (xmlXPathObjectPtr)xmlXPathNewCString(SvPV(perl_result, len));
FINISH:
-
valuePush(ctxt, ret);
PUTBACK;
FREETMPS;
LEAVE;
}
+
int
LibXSLT_input_match(char const * filename)
@@ -807,6 +830,7 @@
SV *key;
STRLEN len;
char *strkey;
+
PERL_UNUSED_VAR(self);
/* todo: Add checking of uri and name in here! */
xsltRegisterExtModuleFunction((const xmlChar *)name,
@@ -819,7 +843,7 @@
sv_catpv(key, (const char*)name);
strkey = SvPV(key, len);
/* warn("Trying to store function '%s' in %d\n", strkey, LibXSLT_HV_allCallbacks); */
- hv_store(LibXSLT_HV_allCallbacks, strkey, len, SvREFCNT_inc(callback), 0);
+ (void) hv_store(LibXSLT_HV_allCallbacks, strkey, len, SvREFCNT_inc(callback), 0);
SvREFCNT_dec(key);
}
@@ -831,13 +855,13 @@
if (items > 1) {
SV * debug_cb = ST(1);
if (debug_cb && SvTRUE(debug_cb)) {
- SET_CB(LibXSLT_debug_cb, ST(1));
+ SET_CB(LibXSLT_debug_cb, debug_cb);
}
else {
LibXSLT_debug_cb = NULL;
}
}
- RETVAL = LibXSLT_debug_cb ? sv_2mortal(LibXSLT_debug_cb) : &PL_sv_undef;
+ RETVAL = LibXSLT_debug_cb ? LibXSLT_debug_cb : &PL_sv_undef;
OUTPUT:
RETVAL
@@ -945,10 +969,11 @@
SV * wrapper
SV * sv_doc
PREINIT:
- # note really only 254 entries here - last one is NULL
- const char *xslt_params[255];
+ const char *xslt_params[255]; /* note really only 254 entries here - last one is NULL */
xmlDocPtr real_dom;
xmlDocPtr doc;
+ xmlNodePtr dtd_prev = NULL;
+ xmlNodePtr dtd_next = NULL;
SV * saved_error = sv_2mortal(newSVpv("",0));
xsltTransformContextPtr ctxt;
xsltSecurityPrefsPtr sec;
@@ -995,8 +1020,27 @@
ctxt->xinclude = 1;
ctxt->_private = (void *) wrapper;
sec = LibXSLT_init_security_prefs(ctxt);
+
+ if (doc->intSubset != NULL) {
+ /* Note: libxslt will unlink intSubset, we
+ want to restore it when done
+ */
+ dtd_prev = doc->intSubset->prev;
+ dtd_next = doc->intSubset->next;
+ }
+
real_dom = xsltApplyStylesheetUser(self, doc, xslt_params,
NULL, NULL, ctxt);
+ if (doc->intSubset != NULL &&
+ doc->prev == NULL && doc->next == NULL) {
+ xmlNodePtr cur = (xmlNodePtr) doc->intSubset;
+ cur->prev = dtd_prev;
+ cur->next = dtd_next;
+ if (dtd_prev) dtd_prev->next = cur;
+ if (dtd_next) dtd_next->prev = cur;
+ if (doc->children == dtd_next) doc->children = cur;
+ if (doc->last == dtd_prev) doc->last = cur;
+ }
if ((real_dom != NULL) && (ctxt->state != XSLT_STATE_OK)) {
/* fatal error */
xmlFreeDoc(real_dom);
Modified: branches/upstream/libxml-libxslt-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-libxslt-perl/current/MANIFEST?rev=46086&op=diff
==============================================================================
--- branches/upstream/libxml-libxslt-perl/current/MANIFEST (original)
+++ branches/upstream/libxml-libxslt-perl/current/MANIFEST Mon Oct 19 16:23:42 2009
@@ -35,6 +35,7 @@
t/12import.t
t/13error.t
t/14security.t
+t/15misc.t
testcases/default.conf
typemap
META.yml Module meta-data (added by MakeMaker)
Modified: branches/upstream/libxml-libxslt-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-libxslt-perl/current/META.yml?rev=46086&op=diff
==============================================================================
--- branches/upstream/libxml-libxslt-perl/current/META.yml (original)
+++ branches/upstream/libxml-libxslt-perl/current/META.yml Mon Oct 19 16:23:42 2009
@@ -1,11 +1,22 @@
-# http://module-build.sourceforge.net/META-spec.html
-#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX#
-name: XML-LibXSLT
-version: 1.68
-version_from: LibXSLT.pm
-installdirs: site
+--- #YAML:1.0
+name: XML-LibXSLT
+version: 1.70
+abstract: Interface to Gnome libxslt library
+author:
+ - Matt Sergeant
+license: unknown
+distribution_type: module
+configure_requires:
+ ExtUtils::MakeMaker: 0
+build_requires:
+ ExtUtils::MakeMaker: 0
requires:
- XML::LibXML: 1.67
-
-distribution_type: module
-generated_by: ExtUtils::MakeMaker version 6.30
+ XML::LibXML: 1.70
+no_index:
+ directory:
+ - t
+ - inc
+generated_by: ExtUtils::MakeMaker version 6.52
+meta-spec:
+ url: http://module-build.sourceforge.net/META-spec-v1.4.html
+ version: 1.4
Modified: branches/upstream/libxml-libxslt-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-libxslt-perl/current/Makefile.PL?rev=46086&op=diff
==============================================================================
--- branches/upstream/libxml-libxslt-perl/current/Makefile.PL (original)
+++ branches/upstream/libxml-libxslt-perl/current/Makefile.PL Mon Oct 19 16:23:42 2009
@@ -1,4 +1,10 @@
-# $Id: Makefile.PL 211 2008-11-05 10:30:33Z pajas $
+# -------------------------------------------------------------------------- #
+# $Id: Makefile.PL 228 2009-10-07 12:25:23Z pajas $
+# -------------------------------------------------------------------------- #
+# Makefile.PL for XML::LibXML.
+# This file is required to generate a localized Makefile
+# -------------------------------------------------------------------------- #
+
BEGIN {
if ($] < 5.006_001) {
@@ -76,11 +82,46 @@
}
}
-if ($config{LIBS} !~ /\-lxslt/) {
- $config{LIBS} .= ' -lxslt -lxml2 -lz -lm';
-}
-
-if (!have_library("xslt")) {
+if ($config{LIBS} !~ /\-l(lib)?xslt\b/) {
+ # in this case we are not able to run xml2-config. therefore we need to
+ # expand the libz as well.
+ if ($is_Win32) {
+ if( $ENV{ACTIVEPERL_MINGW} ) {
+ $config{LIBS} .= ' -llibxslt.lib -llibxml2.lib';
+ } else {
+ $config{LIBS} .= ' -llibxslt -llibxml2';
+ }
+ } else {
+ $config{LIBS} .= ' -lxml2 -lz';
+ }
+}
+
+if ($config{LIBS} !~ /\-lz(lib)?\b/ and !($is_win32 && $config{LIBS} !~ /\-lzlib\b/)) {
+ # note if libxml2 has not -lz within its cflags, we should not use
+ # it! We should trust libxml2 and assume libz is not available on the
+ # current system (this is ofcourse not true with win32 systems.
+ # $config{LIBS} .= $is_Win32 ? ' -lzlib' :' -lz';
+ if ( $config{DEBUG} ) {
+ warn "zlib was not configured\n";
+ warn "set zlib\n" if $is_Win32;
+ }
+ if ($is_Win32) {
+ if( $ENV{ACTIVEPERL_MINGW} ) {
+ $config{LIBS} .= '';
+ } else {
+ $config{LIBS} .= ' -lzlib';
+ }
+ } else {
+ $config{LIBS} .= ' -lz';
+ }
+}
+
+if ($config{LIBS} !~ /\-lm\b/) {
+ # math support is important, but is not available separately in W32
+ $config{LIBS} .= $is_Win32 ? '' :' -lm';
+}
+
+if (!have_library($is_Win32 ? "libxslt" : "xslt")) {
print STDERR <<DEATH;
libxslt not found
Try setting LIBS and INC values on the command line
@@ -93,8 +134,10 @@
}
-if (have_library("exslt")) {
- my $exslt_defaults = q/-lexslt -lgcrypt -lgpg-error/;
+if (have_library($is_Win32 ? "libexslt" : "exslt")) {
+ my $exslt_defaults = $is_Win32 ?
+ ($ENV{ACTIVEPERL_MINGW} ? q/-llibexslt.lib/ : q/-llibexslt/) :
+ q/-lexslt/; # -lgcrypt -lgpg-error/;
my $exsltcfg = 'pkg-config libexslt';
my ($exslt_libs,$exslt_inc);
eval {
@@ -124,12 +167,41 @@
print "INC: $config{INC}\n";
}
+my $ldflags = delete $config{LDFLAGS};
+if ($ldflags) {
+ $config{dynamic_lib} = { OTHERLDFLAGS => " $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;
+******************************** !!!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
+module's DLL name. Therefore we have to use LibXSLT.dll that will clash with the
+standard name of xslt library DLL. Please consider renaming your xslt library
+to e.g. libxslt_win32.dll and then make the appropriate changes to this module's
+build process to look for that instead of standard libxslt.dll. If you do not
+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);
+ }
+}
+
WriteMakefile(
'NAME' => 'XML::LibXSLT',
'VERSION_FROM' => 'LibXSLT.pm', # finds $VERSION
'AUTHOR' => 'Matt Sergeant',
'ABSTRACT' => 'Interface to Gnome libxslt library',
- 'PREREQ_PM' => { 'XML::LibXML' => "1.67", },
+ 'PREREQ_PM' => { 'XML::LibXML' => "1.70", },
'OBJECT' => '$(O_FILES)',
%config,
);
@@ -191,11 +263,11 @@
}
sub xsystem {
- my $command = shift;
+ my (@command)=@_;
if ($DEBUG) {
- print $command, "\n";
- if (system($command) != 0) {
- die "system call to '$command' failed";
+ print "@command\n";
+ if (system(@command) != 0) {
+ die "system call to '@command' failed";
}
return 1;
}
@@ -203,11 +275,11 @@
open(OLDERR, ">&STDERR");
open(STDOUT, ">$DEVNULL");
open(STDERR, ">$DEVNULL");
- my $retval = system($command);
+ my $retval = system(@command);
open(STDOUT, ">&OLDOUT");
open(STDERR, ">&OLDERR");
if ($retval != 0) {
- die "system call to '$command' failed";
+ die "system call to '@command' failed";
}
return 1;
}
@@ -298,9 +370,10 @@
use Conftest; \$loaded++;
EOT
close($cfile);
- xsystem("$^X Makefile.PL " . join(' ', map { "'$_=$config{$_}'" } keys %config));
- my $file = $config{MAKEAPERL} ? "-f Makefile.aperl FIRST_MAKEFILE=Makefile.aperl" : "";
- xsystem("$Config{make} $file test 'OTHERLDFLAGS=$opt'");
+ xsystem($^X,'Makefile.PL',map "$_=$config{$_}", keys %config);
+ xsystem($Config{make},
+ ($config{MAKEAPERL} ? qw(-f Makefile.aperl FIRST_MAKEFILE=Makefile.aperl) : ()),
+ 'test'); #,"OTHERLDFLAGS=".$opt);
}
sub try_link {
Modified: branches/upstream/libxml-libxslt-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-libxslt-perl/current/README?rev=46086&op=diff
==============================================================================
--- branches/upstream/libxml-libxslt-perl/current/README (original)
+++ branches/upstream/libxml-libxslt-perl/current/README Mon Oct 19 16:23:42 2009
@@ -10,14 +10,29 @@
A NOTE ON INSTALLATION
----------------------
+The library depends on libxslt. You have to have both the library and
+its header files installed (on various Linux/UNIX distributions thay
+are usually packaged as libxslt-dev or libxslt-devel). The module can
+further make use of libexslt, which is distributed with libxslt, but
+on some systems packaged separately. These libraries may have their
+own dependencies (usually resolved automatically by the packaging
+system).
+
Note that if you want any global data to be shared between the libxml2
libraries used by this module and XML-LibXML, e.g. the input callback
table, then each module must link dynamically against libxml2 so that
they both use the same shared library (this is in fact default on most
UNIX/POSIX platforms).
-WIN32 BUILDING ISSUES
----------------------
+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="..."
+
+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 ...).
+
+WIN32 BUILDING ISSUES ---------------------
It is recommended that when building this module on Win32 you also
link dynamically against libxslt and libexslt, since linking
@@ -55,4 +70,4 @@
---------------------
This is free software, you may use it and distribute it under the same
-terms as Perl itself. Copyright 2001 AxKit.com Ltd, All rights reserved.
+terms as Perl itself. Copyright 2001 AxKit.com Ltd.
Modified: branches/upstream/libxml-libxslt-perl/current/perl-libxml-mm.c
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-libxslt-perl/current/perl-libxml-mm.c?rev=46086&op=diff
==============================================================================
--- branches/upstream/libxml-libxslt-perl/current/perl-libxml-mm.c (original)
+++ branches/upstream/libxml-libxslt-perl/current/perl-libxml-mm.c Mon Oct 19 16:23:42 2009
@@ -1,12 +1,18 @@
/**
* perl-libxml-mm.c
- * $Id: perl-libxml-mm.c 211 2008-11-05 10:30:33Z pajas $
+ * $Id: perl-libxml-mm.c 218 2009-09-23 08:13:16Z pajas $
*
* Basic concept:
* perl varies in the implementation of UTF8 handling. this header (together
* with the c source) implements a few functions, that can be used from within
* the core module inorder to avoid cascades of c pragmas
*/
+/*
+ * This is free software, you may use it and distribute it under the same terms as
+ * Perl itself.
+ *
+ * Copyright 2001-2009 AxKit.com Ltd.
+*/
#ifdef __cplusplus
extern "C" {
@@ -109,11 +115,12 @@
/*
* efficiently generate a string representation of the given pointer
*/
+#define _PMM_HASH_NAME_SIZE(n) n+(n>>3)+(n%8>0 ? 1 : 0)
xmlChar *
x_PmmRegistryName(void * ptr)
{
unsigned long int v = (unsigned long int) ptr;
- int HASH_NAME_SIZE = sizeof(void *) + ceil(sizeof(void *)/8);
+ int HASH_NAME_SIZE = _PMM_HASH_NAME_SIZE(sizeof(void*));
xmlChar * name;
int i;
@@ -212,12 +219,24 @@
}
if ( node->_private == NULL ) {
- proxy = (ProxyNodePtr)xmlMalloc(sizeof(struct _ProxyNode));
+ switch ( node->type ) {
+ case XML_DOCUMENT_NODE:
+ case XML_HTML_DOCUMENT_NODE:
+ case XML_DOCB_DOCUMENT_NODE:
+ proxy = (ProxyNodePtr)xmlMalloc(sizeof(struct _DocProxyNode));
+ if (proxy != NULL) {
+ ((DocProxyNodePtr)proxy)->psvi_status = Pmm_NO_PSVI;
+ x_SetPmmENCODING(proxy, XML_CHAR_ENCODING_NONE);
+ }
+ break;
+ default:
+ proxy = (ProxyNodePtr)xmlMalloc(sizeof(struct _ProxyNode));
+ break;
+ }
if (proxy != NULL) {
proxy->node = node;
proxy->owner = NULL;
proxy->count = 0;
- proxy->encoding= 0;
node->_private = (void*) proxy;
}
}
@@ -319,7 +338,7 @@
case XML_HTML_DOCUMENT_NODE:
case XML_DOCB_DOCUMENT_NODE:
if ( ((xmlDocPtr)node)->encoding != NULL ) {
- dfProxy->encoding = (int)xmlParseCharEncoding( (const char*)((xmlDocPtr)node)->encoding );
+ x_SetPmmENCODING(dfProxy, (int)xmlParseCharEncoding( (const char*)((xmlDocPtr)node)->encoding ));
}
break;
default:
Modified: branches/upstream/libxml-libxslt-perl/current/perl-libxml-mm.h
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-libxslt-perl/current/perl-libxml-mm.h?rev=46086&op=diff
==============================================================================
--- branches/upstream/libxml-libxslt-perl/current/perl-libxml-mm.h (original)
+++ branches/upstream/libxml-libxslt-perl/current/perl-libxml-mm.h Mon Oct 19 16:23:42 2009
@@ -1,12 +1,18 @@
/**
* perl-libxml-mm.h
- * $Id: perl-libxml-mm.h 208 2008-11-04 13:29:43Z pajas $
+ * $Id: perl-libxml-mm.h 218 2009-09-23 08:13:16Z pajas $
*
* Basic concept:
* perl varies in the implementation of UTF8 handling. this header (together
* with the c source) implements a few functions, that can be used from within
* the core module inorder to avoid cascades of c pragmas
*/
+/*
+ * This is free software, you may use it and distribute it under the same terms as
+ * Perl itself.
+ *
+ * Copyright 2001-2009 AxKit.com Ltd.
+*/
#ifndef __PERL_LIBXML_MM_H__
#define __PERL_LIBXML_MM_H__
@@ -49,29 +55,43 @@
xmlNodePtr node;
xmlNodePtr owner;
int count;
- int encoding;
};
+struct _DocProxyNode {
+ xmlNodePtr node;
+ xmlNodePtr owner;
+ int count;
+ int encoding; /* only used for proxies of xmlDocPtr */
+ int psvi_status; /* three-state flag for a document */
+};
+
+#define Pmm_NO_PSVI 0
+#define Pmm_PSVI_TAINTED 1
+
/* helper type for the proxy structure */
+typedef struct _DocProxyNode DocProxyNode;
typedef struct _ProxyNode ProxyNode;
/* pointer to the proxy structure */
typedef ProxyNode* ProxyNodePtr;
+typedef DocProxyNode* DocProxyNodePtr;
/* this my go only into the header used by the xs */
-#define SvPROXYNODE(x) ((ProxyNodePtr)SvIV(SvRV(x)))
-#define SvNAMESPACE(x) ((xmlNsPtr)SvIV(SvRV(x)))
-#define x_PmmPROXYNODE(x) ((ProxyNodePtr)x->_private)
+#define SvPROXYNODE(x) (INT2PTR(ProxyNodePtr,SvIV(SvRV(x))))
+#define PmmPROXYNODE(x) (INT2PTR(ProxyNodePtr,x->_private))
+#define SvNAMESPACE(x) (INT2PTR(xmlNsPtr,SvIV(SvRV(x))))
#define x_PmmREFCNT(node) node->count
#define x_PmmREFCNT_inc(node) node->count++
#define x_PmmNODE(xnode) xnode->node
#define x_PmmOWNER(node) node->owner
#define x_PmmOWNERPO(node) ((node && x_PmmOWNER(node)) ? (ProxyNodePtr)x_PmmOWNER(node)->_private : node)
-#define x_PmmENCODING(node) node->encoding
-
-#define x_PmmNodeEncoding(node) ((ProxyNodePtr)(node->_private))->encoding
-#define x_PmmDocEncoding(node) (node->charset)
+
+#define x_PmmENCODING(node) ((DocProxyNodePtr)(node))->encoding
+#define x_PmmNodeEncoding(node) ((DocProxyNodePtr)(node->_private))->encoding
+
+#define x_SetPmmENCODING(node,code) x_PmmENCODING(node)=(code)
+#define x_SetPmmNodeEncoding(node,code) x_PmmNodeEncoding(node)=(code)
#ifndef NO_XML_LIBXML_THREADS
#ifdef USE_ITHREADS
Modified: branches/upstream/libxml-libxslt-perl/current/t/10functions.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-libxslt-perl/current/t/10functions.t?rev=46086&op=diff
==============================================================================
--- branches/upstream/libxml-libxslt-perl/current/t/10functions.t (original)
+++ branches/upstream/libxml-libxslt-perl/current/t/10functions.t Mon Oct 19 16:23:42 2009
@@ -1,5 +1,5 @@
use Test;
-BEGIN { plan tests => 33 }
+BEGIN { plan tests => 35 }
use XML::LibXSLT;
{
@@ -163,3 +163,73 @@
XML
ok ($result->serialize,qq(<?xml version="1.0"?>\n<out><b><b/></b><b><c/></b></out>\n));
}
+
+{
+ my $callbackNS = "http://x/x";
+
+ my $p = XML::LibXML->new;
+ my $xsltproc = XML::LibXSLT->new;
+ $xsltproc->register_function(
+ $callbackNS,
+ "some_function",
+ sub {
+ my($format) = @_;
+ return $format;
+ }
+ );
+ $xsltproc->register_function(
+ $callbackNS,
+ "some_function2",
+ sub {
+ my($format) = @_;
+ return $format->[0];
+ }
+ );
+
+ 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:x="http://x/x"
+>
+
+<xsl:template match="root">
+ <root>
+ <xsl:value-of select="x:some_function(@format)" />
+ <xsl:text>,</xsl:text>
+ <xsl:value-of select="x:some_function(.)" />
+ <xsl:text>,</xsl:text>
+ <xsl:value-of select="x:some_function(processing-instruction())" />
+ <xsl:text>,</xsl:text>
+ <xsl:value-of select="x:some_function(text())" />
+ <xsl:text>;</xsl:text>
+
+ <xsl:value-of select="x:some_function2(@format)" />
+ <xsl:text>,</xsl:text>
+ <xsl:value-of select="x:some_function2(.)" />
+ <xsl:text>,</xsl:text>
+ <xsl:value-of select="x:some_function2(processing-instruction())" />
+ <xsl:text>,</xsl:text>
+ <xsl:value-of select="x:some_function2(text())" />
+ <xsl:text>;</xsl:text>
+ <xsl:for-each select="x:some_function(node())">
+ <xsl:value-of select="." />
+ </xsl:for-each>
+ </root>
+</xsl:template>
+
+</xsl:stylesheet>
+EOF
+
+ my $doc = $p->parse_string(<<EOF);
+<root format="foo">bar<?baz bak?><y>zzz</y></root>
+EOF
+
+ my $stylesheet = $xsltproc->parse_stylesheet($xsltdoc);
+ my $result = $stylesheet->transform($doc);
+ my $val = $result->findvalue("/root");
+ ok($val);
+ ok($val eq "foo,barzzz,bak,bar;foo,barzzz,bak,bar;barbakzzz")
+ or print $stylesheet->output_as_bytes($result);
+
+}
Added: branches/upstream/libxml-libxslt-perl/current/t/15misc.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-libxslt-perl/current/t/15misc.t?rev=46086&op=file
==============================================================================
--- branches/upstream/libxml-libxslt-perl/current/t/15misc.t (added)
+++ branches/upstream/libxml-libxslt-perl/current/t/15misc.t Mon Oct 19 16:23:42 2009
@@ -1,0 +1,70 @@
+# -*- cperl -*-
+
+use Test;
+BEGIN { plan tests => 4 }
+use XML::LibXML 1.70;
+use XML::LibXSLT;
+
+{
+ # test for #41542 - DTD subset disappeare
+ # in the source document after the transformation
+ my $parser = XML::LibXML->new();
+ $parser->validation(1);
+ $parser->expand_entities(0);
+ my $xml = <<'EOT';
+<?xml version="1.0" standalone="no"?>
+<!DOCTYPE article [
+<!ENTITY foo "FOO">
+<!ELEMENT article (#PCDATA)>
+]>
+<article>&foo;</article>
+EOT
+ my $doc = $parser->parse_string($xml);
+
+ my $xslt = XML::LibXSLT->new();
+ $parser->validation(0);
+ my $style_doc = $parser->parse_string(<<'EOX');
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+<xsl:template match="/">
+<out>hello</out>
+</xsl:template>
+</xsl:transform>
+EOX
+
+ ok($doc->toString() eq $xml);
+ $xslt->parse_stylesheet($style_doc)->transform($doc);
+ ok($doc->toString() eq $xml);
+
+}
+
+{
+ # test work-around for rt #29572
+
+ my $parser = XML::LibXML->new();
+ my $source = $parser->parse_string(<<'EOT');
+<some-xml/>
+EOT
+ my $style_doc = $parser->load_xml(string=><<'EOT2',no_cdata=>1);
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+ <xsl:template match="/" >
+ <xsl:text
+ disable-output-escaping="yes"><![CDATA[<tr>]]></xsl:text>
+ </xsl:template>
+
+</xsl:stylesheet>
+EOT2
+ my $xslt = XML::LibXSLT->new();
+ my $stylesheet = $xslt->parse_stylesheet($style_doc);
+
+ my $results = $stylesheet->transform($source);
+ ok($results);
+ my $out = $stylesheet->output_string($results);
+ ok($out eq <<'EOF') or print $out;
+<?xml version="1.0"?>
+<tr>
+EOF
+
+}
More information about the Pkg-perl-cvs-commits
mailing list