Skip Menu |

This queue is for tickets about the XML-LibXSLT CPAN distribution.

Report information
The Basics
Id: 93349
Status: resolved
Priority: 0/
Queue: XML-LibXSLT

People
Owner: Nobody in particular
Requestors: NWELLNHOF [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Passing XML document from Perl + exslt:node-set causes weird behavior
This is a copy of GNOME Bugzilla bug #562302 filed by Alexander Schepanovski against libxslt: https://bugzilla.gnome.org/show_bug.cgi?id=562302 ------------------------------------------------- Perl code making trouble: #!/usr/bin/perl use XML::LibXML; use XML::LibXSLT; my $parser = new XML::LibXML; my $xslt = new XML::LibXSLT; # registering function my $doc; sub cfg { my $xml = q~<?xml version="1.0" encoding="utf-8"?><xml_storage></xml_storage>~; return $doc = $parser->parse_string($xml); } XML::LibXSLT->register_function("urn:perl", 'cfg', \&cfg); # loading and parsing stylesheet my $style_doc = $parser->parse_file("skeleton.xsl"); my $stylesheet = $xslt->parse_stylesheet($style_doc); # performing transform my $source = new XML::LibXML::Document; my $results = $stylesheet->transform($source); # writing result open F, ">result.xml" or die; print F $stylesheet->output_string($results); close F; Where skeleton.xsl is: <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.1" 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:value-of select="$xml_storage"/></result> </xsl:template> </xsl:stylesheet> Result is <?xml version="1.0"?> <result>bye</result> It seems that value of $xml_storage varies depending on its use in diffrent part of xsl stylesheet. It also depend on its true value passed from perl. Varying stylesheet and xml document passed from perl, you can even get segfault.
On Tue Feb 25 10:33:38 2014, NWELLNHOF wrote: Show quoted text
> Fixed in my Bitbucket repo: > > https://bitbucket.org/nwellnhof/perl-xml- > libxslt/commits/7bfbae8885464b0dc70ae28c715507c6d70854fe
Hi Nick, this link is broken - even in the original message: https://bitbucket.org/nwellnhof/perl-xml-libxslt/commits/7bfbae8885464b0dc70ae28c715507c6d70854fe Plus, the example program suffers from many bad idioms (which is fixable, but still). Regards, -- Shlomi Fish.
RT-Send-CC: SHLOMIF [...] cpan.org
Hi Shlomi, i moved that commit into my updated pull request, so you already merged it: https://bitbucket.org/shlomif/perl-xml-libxslt/commits/1e456fdd5b2c9ad43207c92eac56a6ef289211ce Nick
On Thu Mar 06 13:32:22 2014, NWELLNHOF wrote: Show quoted text
> Hi Shlomi, > > i moved that commit into my updated pull request, so you already > merged it: > > https://bitbucket.org/shlomif/perl-xml- > libxslt/commits/1e456fdd5b2c9ad43207c92eac56a6ef289211ce > > Nick
Hi Nick, thanks. So I'll mark it as RESOLVED. Regards, -- Shlomi Fish.