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 171488 - position()=last() not working as expected on v10112
position()=last() not working as expected on v10112
Status: VERIFIED FIXED
Product: libxslt
Classification: Platform
Component: general
1.1.12
Other All
: Normal normal
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2005-03-24 13:30 UTC by Ben Ko
Modified: 2009-08-15 18:40 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Ben Ko 2005-03-24 13:30:39 UTC
Please describe the problem:
position()=last() not working as expected when using Mac OS X binary 
distribution of libxslt v10112 and libxml v20615 or Windows binary 
distribution of libxslt (same libxslt version, different libxml--20617). 

for comparison, position()=last() detection is working as expected when using 
other xslt processors including sablotron, xalan, and saxon.

Steps to reproduce:
1.Given the following input file:

<orderedlist numeration="arabic" spacing="normal" inheritnum="ignore" 
continuation="restarts"><listitem><para>test</para></listitem>
<listitem><para>test</para></listitem>
<listitem><para>test</para></listitem></orderedlist>

and following xsl:template 

<?xml version="1.0" encoding="iso-8859-1"?>

<xsl:stylesheet

   version="1.0"
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output method="xml" /> 
<!--match first element of last item of any orderedlist-->
<xsl:template match="orderedlist/listitem[position()!=1][position()=last()]/*
[1]"><xsl:text>First element of last item of 
orderedlist</xsl:text><xsl:copy><xsl:apply-templates select="@*|node
()"/></xsl:copy>
</xsl:template>

</xsl:template>

</xsl:stylesheet>

I expect to get:

<?xml version="1.0"?>

test
test
First para of last item of orderedlist<para>test</para>

But the template does not match at all so i just get

test
test
test

2. As a point of contrast, the pattern above In contrast does work as i 
expected in sablotron, xalan, and saxon.

If i remove the "/*[1]" from the template, i.e. change

<xsl:template match="orderedlist/listitem[position()!=1][position()=last()]/*
[1]"> 

to

<xsl:template match="orderedlist/listitem[position()!=1][position()=last()]">

the pattern matches, though it is now a different pattern and does not insert 
the marker where i want it to be.

Actual results:
The output is:

test
test
test

Expected results:
output should be:

test
test
First para of last item of orderedlist<para>test</para>

Other xlst processors are outputting that.

Does this happen every time?
Yes

Other information:
Yes, thanks for the help you are providing to me and all other comers! It is 
very much appreciated.
Comment 1 Daniel Veillard 2005-03-31 09:57:05 UTC
Okay, fixed in CVS, as far as I can tell this bug has been there forever !
I added your test to libxslt regression suite,

  thanks a lot,

Daniel
Comment 2 Daniel Veillard 2005-09-05 09:44:12 UTC
This should be closed by release of libxslt-1.1.15

  thanks,

Daniel