[xslt] BUG: Top-level variables wrongly assigned param data



The Problem:

Top-level <xsl:variable> defintions are assigned the value of parameters 
passed in that share the same name (conflating them with top-level 
<xsl:param> definitions).

The minimal test case:

test.xsl
------------------
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
version="1.0">
<xsl:variable name="test">no value</xsl:variable>

<xsl:template match="/">
<root>
   param: <xsl:value-of select="$test"/>
</root>
</xsl:template>

</xsl:stylesheet>
-----------

test.xml
------------
<?xml version="1.0"?>
<root/>
------------

Running

xsltproc --stringparam test passed-value test.xsl test.xml

yields:

<?xml version="1.0"?>
<root>
   param: passed-value
</root>

Where it should give:

<?xml version="1.0"?>
<root>
   param: no value
</root>

The value of the param passed in should only ever be assigned to an 
<xsl:param> whose name attribute matches, never an <xsl:variable>.

Version info:
xsltproc --version
Using libxml 20503, libxslt 10023 and libexslt 714
xsltproc was compiled against libxml 20430, libxslt 10023 and libexslt 714
libxslt 10023 was compiled against libxml 20430
libexslt 714 was compiled against libxml 20430

-kip






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]