[xslt] apparent corruption of global variable value in a specific case
- From: Peter Pawlowski <pawlowski vivisimo com>
- To: xslt gnome org
- Subject: [xslt] apparent corruption of global variable value in a specific case
- Date: Mon, 12 Jan 2009 15:43:20 -0500
Hello,
We seem to have discovered a strange bug in libxslt where the value of a
global variable is being reported incorrectly as an empty string.
This occurs if you have a certain combination of global variables,
template calls and functions returning result tree fragments.
Here is the output of the test case (just run it against itself), the
libxslt version information, and the test case itself:
[pawlowski dev3 libxml]$ ./bin/xsltproc test-case.xsl test-case.xsl
assert 'success!' == ''
[pawlowski dev3 libxml]$ ./bin/xsltproc --version
Using libxml 20702, libxslt 10124 and libexslt 813
xsltproc was compiled against libxml 20702, libxslt 10124 and libexslt 813
libxslt 10124 was compiled against libxml 20702
libexslt 813 was compiled against libxml 20702
=== our test case ===
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
xmlns:func='http://exslt.org/functions'
xmlns:foo='http://foo.com/'
extension-element-prefixes='func'
>
<xsl:output method="text" />
<!-- $func-value should have the value 'success!' but instead reports an
empty string -->
<xsl:variable name="func-value" select="foo:get-value()" />
<xsl:variable name="dummy-value" select="$func-value" />
<xsl:variable name="template-value">
<xsl:call-template name="get-dummy" />
</xsl:variable>
<func:function name="foo:get-value">
<func:result>success!</func:result>
<!-- use this func:result instead and $func-value will report the
expected value
<func:result select="'success!'" />
-->
</func:function>
<xsl:template name="get-dummy">
<xsl:value-of select="$dummy-value" />
</xsl:template>
<xsl:template match="/">
<xsl:text>assert 'success!' == '</xsl:text>
<xsl:value-of select="$func-value" />
<xsl:text>'
</xsl:text>
</xsl:template>
</xsl:stylesheet>
=== end test case ===
It seems obscure, but in our very complex, several thousand line XSL
transformations, this actually comes up pretty frequently and is
frustrating to debug -- I hope you might be able to help us fix the problem.
Thanks for your help,
Peter Pawlowski
--
PETER PAWLOWSKI
Senior Software Engineer
pawlowski vivisimo com
Vivisimo [Search Done Right]
1710 Murray Avenue
Pittsburgh, PA 15217 USA
tel: +1.412.422.2499 x116
fax: +1.412.422.2495
vivisimo.com clusty.com
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]