logo       

More XML::LibXSLT registered functions woes: msg#00044

lang.perl.xml

Subject: More XML::LibXSLT registered functions woes

Using the CVS versions of XML::LibXML and XML::LibXSLT (with Petr Pajas latest patch), this script apparently does _not_ work as expected:

======================================================

use strict;
use warnings;

use XML::LibXML ();
use XML::LibXSLT ();

my $libxml = XML::LibXML->new;
my $libxslt = XML::LibXSLT->new;

sub foo { $libxml->parse_string( qq{<foo zap="zoo">bar</foo>} ) };
XML::LibXSLT->register_function( 'urn:bar','func','foo' );

my $dom = $libxml->parse_string( "<empty/>" );

my $xslt = $libxml->parse_string( <<'EOD' );
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:foo="urn:bar"
exclude-result-prefixes="foo"

<xsl:output omit-xml-declaration="yes"/>
<xsl:template match="/">

<xsl:copy-of select="foo:func()"/>

</xsl:template>
</xsl:stylesheet>
EOD

my $stylesheet = $libxslt->parse_stylesheet( $xslt );

my $newdom = $stylesheet->transform( $dom );

print $stylesheet->output_string( $newdom ); # should print "<foo zap="zoo">bar</foo>" ======================================================

but instead of the expected string, it prints:

XML::LibXML::Document=SCALAR(0xdeadbeef)


The funny thing is that I have this executing in a more complex situation as expected. But the very simple case seems to fail. Or am I missing something here?


Liz
_______________________________________________
Perl-XML mailing list
Perl-XML@xxxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise