Hello, first, there's a references recap I found for this topic:
- original mail I've borrowed the subject from [1] - bugzilla.gnome.org bug [2] - thread on xsl-list ML [3], which may explain why Saxon behaves as it does (and hence differs from current behavior of libxslt in this aspect) I also have just observed this possible discrepancy with something that can be distilled to this test case serving both as a template and the input to proceed: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:int="__internal__"> <xsl:output method="text" indent="no"/> <xsl:key name="revmap-bar-to-foo" match="int:foo" use="//int:bar[@name = current()/@name]"/> <int:foo name="bla"/> <int:foo name="bla"/> <int:foo name="bla"/> <int:bar name="bla"/> <xsl:template match="*"> <xsl:value-of select="concat( 'answer1:', count(int:foo), '
', 'answer2:', count(key('revmap-bar-to-foo', //int:bar[@name='bla'])) )"/> </xsl:template> </xsl:stylesheet> with xsltproc: > answer1:3 > answer2:0 with saxon: > answer1:3 > answer2:3 So my initial question is if something prevents current() being evaluated in the context of key's use parameter as per common sense for XSLT and also as per another XSLT processor, i.e., to have it represent the particular node that was selected as per key's match parameter while building the key table up. Also, I was unable to come up with a general workaround solution (except for theoretical key-less procedural bruteforce technique rendering key's XSLT provision rather limited, which is another reason I think disabling current() there is not in line with the natural intentions). When this situation is more clear, I can try putting some effort to patching such as-of-then bug, but maybe it's just a feature :) Disclaimer: I haven't studied XSLT spec enough to find any authoritative {counter-,}argument. [1] https://mail.gnome.org/archives/xslt/2008-April/msg00027.html [2] https://bugzilla.gnome.org/show_bug.cgi?id=676335 [3] http://www.mhonarc.org/archive/html/xsl-list/2012-12/msg00129.html -- Jan _______________________________________________ xslt mailing list, project page http://xmlsoft.org/XSLT/ xslt@gnome.org https://mail.gnome.org/mailman/listinfo/xslt