GNOME Bugzilla – Bug 743682
Changing behaviour between 1.1.17
Last modified: 2015-08-08 17:38:15 UTC
With xsltproc with libxslt version 1.1.17 the following process line <xsl:apply-templates select="@*[not(self::date_maj)]|node()"/> process all childs and attribute of the current node except date_maj attribute. In version 1.1.26 the same line doesn't except the date_maj attribute and I have to change the process line to : <xsl:apply-templates select="@*[name()!='date_maj']|node()"/>
The new behavior of libxslt is correct. Using the self axis and a name test with an attribute as context node should return an empty node set. From the XPath spec: "Every axis has a principal node type. If an axis can contain elements, then the principal node type is element; otherwise, it is the type of the nodes that the axis can contain. Thus, - For the attribute axis, the principal node type is attribute. - For the namespace axis, the principal node type is namespace. - For other axes, the principal node type is element. A node test that is a QName is true if and only if the type of the node (see [5 Data Model]) is the principal node type and has an expanded-name equal to the expanded-name specified by the QName." The principal node type of the self axis is element. So a node test on the self axis that is a QName can never be true for an attribute since attributes aren't elements. Only the node test "self::node()" can return the attribute itself.