After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 131971 - predicate selection of union gives alternatingly wrong results
predicate selection of union gives alternatingly wrong results
Status: VERIFIED FIXED
Product: libxslt
Classification: Platform
Component: general
1.1.1
Other Linux
: Normal normal
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2004-01-20 01:52 UTC by Ian Schneider
Modified: 2009-08-15 18:40 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Ian Schneider 2004-01-20 01:52:43 UTC
I discovered this (potential) bug while using slides-3.3 stylesheets for
docbook-slides. I was able to do a workaround in the xpath statement which
caused the problem, and have isolated the case in an example document and
stylesheet.

Here is the document text:

<?xml version="1.0" encoding="utf-8"?>
<document name="doc">
  <group name="group">
    <page name="1"/>
    <page name="2"/>
    <page name="3"/>
    <page name="4"/>
  </group>
</document>

Here is my "stylesheet":
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                version="1.0">
<xsl:template match="/">
  <xsl:apply-templates select="//page"/>
</xsl:template>

<xsl:template match="page">

current page : <xsl:value-of select="@name"/>
--------------------
  dump union : "<xsl:for-each
select="(preceding-sibling::page[1]|parent::group[1]|/document)">
    <xsl:value-of select="name()"/>,</xsl:for-each>"
  union-last : <xsl:value-of select="name(
(preceding-sibling::page[1]|parent::group[1]|/document)[last()] )"/>
  union-last (without /root) : <xsl:value-of select="name(
(preceding-sibling::page[1]|parent::group[1])[last()] )"/>
  preceeding-sibling <xsl:value-of select="name(preceding-sibling::page[1])"/>
  parent-group <xsl:value-of select="name(parent::group[1])"/>
  root <xsl:value-of select="name(/document)"/>
-----------------------
</xsl:template>

</xsl:stylesheet>

The union-last output demonstrates the problem witnessed in slides.
The union-last (without /root) shows my workaround
Hopefully its all pretty obvious.

Ian
Comment 1 William M. Brack 2004-01-22 02:58:32 UTC
This was caused by an error within libxml2/xpath.c, when the last() 
function was used in the predicate of a union (XPath context was not 
being saved during union evaluation).  The corrected source is in 
CVS, and I have also taken the liberty of including your test files 
as a part of the libxslt regression tests (tests/general/bug-141). 
Thank you for your report, as well as your excellent analysis and 
isolation of a rather complicated problem.

Bill
Comment 2 Daniel Veillard 2004-03-25 11:39:27 UTC
This should be closed by release of libxslt-1.1.5,
                                                                                
  thanks,
                                                                                
Daniel