Subject: | Error in CPATH test on node attribute |
Hello,
In the following code, a test on a node attribute does not work. The
expected output (as given by xsltproc for instance) is:
<?xml version="1.0"?>
<ul><li>1 :This is one</li><li>2 :This is two</li><li>3 :This is
three</li></ul>
Using the XML::XSLT module below, I get
<ul><li>1 :This is three</li><li>2 :This is three</li><li>3 :This is
three</li></ul>
Any idea ? Known bug ?
Marcel.
XML::XSLT Revision 1.25 2004/02/19 08:38:40 gellyfish
Perl v5.12.2 ; Linux 2.6.36-gentoo-r5
[program follows:]
use XML::XSLT;
my $xsl='
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<ul>
<li>1 :<xsl:value-of select="uppernode/mynode[@num=1]"/></li>
<li>2 :<xsl:value-of select="uppernode/mynode[@num=2]"/></li>
<li>3 :<xsl:value-of select="uppernode/mynode[@num=3]"/></li>
</ul>
</xsl:template>
</xsl:stylesheet>
';
my $xml="<?xml version='1.0'?>
<uppernode>
<mynode num='1'>This is one</mynode>
<mynode num='2'>This is two</mynode>
<mynode num='3'>This is three</mynode>
</uppernode>
";
my $xslt = XML::XSLT->new($xsl, warnings => 1);
$xslt->transform($xml);
print $xslt->toString."\n";
Subject: | example_problem_xslt.pl |
use XML::XSLT;
my $xsl='
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<ul>
<li>1 :<xsl:value-of select="uppernode/mynode[@num=1]"/></li>
<li>2 :<xsl:value-of select="uppernode/mynode[@num=2]"/></li>
<li>3 :<xsl:value-of select="uppernode/mynode[@num=3]"/></li>
</ul>
</xsl:template>
</xsl:stylesheet>
';
my $xml="<?xml version='1.0'?>
<uppernode>
<mynode num='1'>This is one</mynode>
<mynode num='2'>This is two</mynode>
<mynode num='3'>This is three</mynode>
</uppernode>
";
my $xslt = XML::XSLT->new($xsl, warnings => 1);
$xslt->transform($xml);
print $xslt->toString."\n";