You didn't show any code, example input, or expected output. You did say "I program for a corporation and its all propriety", but that doesn't prevent you from constructing a simple SSCCE that reproduces the issue. I had to build one myself, and only did that because I happened to be curious. I was able to reproduce the issue you described with XML::XSLT. Note that the latest non-developer release is now about 14 years old and the developer release 0.50_5 is ~5 years old.
I would recommend switching to XML::LibXML and XML::LibXSLT, where the variables seem to work as expected.
use warnings; use strict; use XML::LibXSLT; use XML::LibXML; my $source = XML::LibXML->load_xml( string => <<'END_XML' ); <foo> <x one="Foo" two="Bar" /> <x one="Quz" two="Quz" /> </foo> END_XML my $style_doc = XML::LibXML->load_xml( string => <<'END_XSLT', no_cdata => 1 ); <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <bar> <xsl:for-each select="foo/x"> <xsl:variable name="name1" select="@one" /> <xsl:variable name="name2" select="@two" /> <xsl:if test="$name1 = $name2"> <y><xsl:value-of select="@one"/></y> </xsl:if> </xsl:for-each> </bar> </xsl:template> </xsl:stylesheet> END_XSLT my $xslt = XML::LibXSLT->new(); my $stylesheet = $xslt->parse_stylesheet($style_doc); my $results = $stylesheet->transform($source); print $stylesheet->output_as_bytes($results); __END__ <?xml version="1.0"?> <bar><y>Quz</y></bar>
In reply to Re: XML::XSLT v 50_5 error with xsl variables
by haukex
in thread XML::XSLT v 50_5 error with xsl variables
by misterperl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |