GNOME Bugzilla – Bug 707476
Unexpected counting behaviour with position() and extra predicates
Last modified: 2013-09-23 19:50:59 UTC
LibXSLT behaves unexpectedly and imho inconsistently when I try to use "position()" to match certain elements. When I try to transform the simple xml tree in the attached "input.xml", the stylesheets "ok1.xslt" and "ok2.xslt" give this output: <OUT_TREE> <OUT_TWIG> <OUT_LEAF_FIRST>a_first</OUT_LEAF_FIRST> </OUT_TWIG> <OUT_TWIG> <OUT_LEAF_FIRST>b_first</OUT_LEAF_FIRST> <!--- cf. below <OUT_LEAF_OTHER>b_second</OUT_LEAF_OTHER> </OUT_TWIG> </OUT_TREE> Using "dubious.xslt", however, leads to this result: <OUT_TREE> <OUT_TWIG> <OUT_LEAF_FIRST>a_first</OUT_LEAF_FIRST> </OUT_TWIG> <OUT_TWIG> <OUT_LEAF_OTHER>b_first</OUT_LEAF_OTHER> <--- here <OUT_LEAF_OTHER>b_second</OUT_LEAF_OTHER> </OUT_TWIG> </OUT_TREE> To verify the inconsistency I ran the same tests using Xalan-C (Xalan version 1.11.0, Xerces version 3.1.1), Xalan-J2 (2.7.0), and Saxon9 (Saxon-HE 9.4.0.4J ) on openSUSE 12.3 x64. All three processors give me the first output shown above with any of the three stylesheets. So only xsltproc behaves differently when using "dubious.xslt".
Created attachment 254100 [details] XML input The XML input referred to in the bug report.
Created attachment 254101 [details] First stylesheet
Created attachment 254102 [details] Second stylesheet
Created attachment 254103 [details] Apparently problematic stylesheet
*** This bug has been marked as a duplicate of bug 695699 ***