Re: [xslt] ?Bug/Mystery - Xpath last() function - libxml2 2.6.16 r2



There is only one bug here (not 2 as I earlier thought)
I have a typo in my script - which is why BOTH values change to correct when line #20 is changed.


After correction - error output  is then:
<output>
<span>Previous Table (ID=3)</span>
<span>Previous TABLE (ID=2)</span>
<span>Previous TABLE (ID=3)</span>
</output>

Apologies for the rushed example.

Mike

Mike Trotman wrote:

I have installed latest versions on FC2.
Problem still persists - short self-contained example files attached.

[miket www BUGS]$ xsltproc -V
Using libxml 20618, libxslt 10113 and libexslt 811
xsltproc was compiled against libxml 20618, libxslt 10113 and libexslt 811
libxslt 10113 was compiled against libxml 20618
libexslt 811 was compiled against libxml 20618
[miket www BUGS]$ rpm -q libxml2 libxslt
libxml2-2.6.18-1
libxslt-1.1.13-1
[miket www BUGS]$ ls -l
total 12
-rw-rw-r-- 1 miket miket 165 Mar 20 17:49 error_output.xml
-rw-rw-r-- 1 miket miket 1499 Mar 20 17:45 tab-idx.xml
-rwxr-xr-x 1 miket miket 1635 Mar 20 17:48 xpath.xsl


Attached files show the error.

Running
xsltproc xpath.xsl tab-idx.xml
produces:
     1 <?xml version="1.0" encoding="UTF-8"?>
     2 <output>
     3 <span>Previous Table (ID=3)</span>
     4 <span>Previous TABLE (ID=2)</span>
     5 <span>Previous TABLE (ID=2)</span>
     6 </output>

Changing line #20 in xpath.xsl from:
20 <xsl:variable name='TabPrev1' select='( ($XTAB/preceding-sibling::TABLE[1]) | ($XIDX/TABLE[last()]) )[1]'/>
to
20 <xsl:variable name='TabPrev1' select='( ($XTAB/preceding-sibling::TABLE[1]) | ($XIDX/TABLE[$TOT]) )[1]'/>
and then running
xsltproc xpath.xsl tab-idx.xml
produces:
1 <?xml version="1.0" encoding="UTF-8"?>
2 <output>
3 <span>Previous Table (ID=3)</span>
4 <span>Previous TABLE (ID=3)</span>
5 <span>Previous TABLE (ID=3)</span>
6 </output>


Let me know if further info required.

Mike

Daniel Veillard wrote:

On Sun, Mar 20, 2005 at 01:59:54PM +0000, Mike Trotman wrote:


Hi.

I have a strange (=incorrect+weird) behaviour when using libxml2 via xsltproc (and Perl XML:::LibXML/LibXSLT/AxKit)
It looks like using the 'last()' positional function corrupts a nodeset - or something more subtle
- which also affect a subsequent Xpath match!!
(and I don't think I'm doing anything stupid.)



[...]


I haven't managed to find an FC2 version of the latest libxml2 yet - but don't see this listed in any bug fixes.


1/ use the latest version, 2.6.18 and libxslt-1.1.13 . To use them on
FC2 grab the src.rpm from ftp://xmlsoft.org/ and use rpm --rebuild libxml2-2.6.18-1.src.rpm and similar for libxslt.
2/ if the problem persists provide full reproductible test case using
xsltproc, as mail or bugzilla attachements of the stylesheet and
the xml input showing the problem. Debugging partial stylesheets
is not possible,


 thanks,

Daniel



------------------------------------------------------------------------

No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.7.4 - Release Date: 18/03/2005


------------------------------------------------------------------------

_______________________________________________
xslt mailing list, project page http://xmlsoft.org/XSLT/
xslt gnome org
http://mail.gnome.org/mailman/listinfo/xslt




--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.7.4 - Release Date: 18/03/2005



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