GNOME Bugzilla – Bug 764411
multiple attribute sets with the same attribute: wrong attribute chosen
Last modified: 2016-06-21 13:57:29 UTC
A literal output element with two attribute sets listed in xsl:use-attribute-set receives a merged set of attributes from both sets. Should the same attribute appear in both sets, the one from the set mentioned last in xsl:use-attribute-set should win. This is not what xsltproc does, and I think this is a bug. Core of the sample: <xsl:template match="a"> <b xsl:use-attribute-sets="att1 att2"/> </xsl:template> <xsl:attribute-set name="att1"> <xsl:attribute name="att1">1</xsl:attribute> <xsl:attribute name="commonatt"><xsl:message>Applying @commonatt from att1 set</xsl:message>v1</xsl:attribute> </xsl:attribute-set> <xsl:attribute-set name="att2"> <xsl:attribute name="att2">2</xsl:attribute> <xsl:attribute name="commonatt"><xsl:message>Applying @commonatt from att2 set</xsl:message>v2</xsl:attribute> </xsl:attribute-set> Result from xsltproc: $ xsltproc a.xsl a.xml Applying @commonatt from att1 set <?xml version="1.0"?> <b att1="1" commonatt="v1" att2="2"/> Expected result (correct from saxon 6.5.5): $ java -jar ~/lib/saxon.jar a.xml a.xsl Applying @commonatt from att1 set Applying @commonatt from att2 set <?xml version="1.0" encoding="utf-8"?> <b att1="1" commonatt="v2" att2="2"/> Note: not only the wrong value is chosen for @commonatt, but also the side effect is skipped by xsltproc. The defect is present in (OS X): $ xsltproc --version Using libxml 20900, libxslt 10128 and libexslt 817 xsltproc was compiled against libxml 20900, libxslt 10128 and libexslt 817 libxslt 10128 was compiled against libxml 20900 libexslt 817 was compiled against libxml 20900, as well as in (Linux): $ xsltproc --version Using libxml 20901, libxslt 10128 and libexslt 817 xsltproc was compiled against libxml 20901, libxslt 10128 and libexslt 817 libxslt 10128 was compiled against libxml 20901 libexslt 817 was compiled against libxml 20901 Ratio: https://www.w3.org/TR/xslt#attribute-sets: "Specifying a use-attribute-sets attribute is equivalent to adding xsl:attribute elements for each of the attributes in each of the named attribute sets to the beginning of the content of the element with the use-attribute-sets attribute, *in the same order* in which the names of the attribute sets are specified in the use-attribute-sets attribute." The spec regarding the order of addition is not satisfied. Regards, Mike
Created attachment 325077 [details] 764411-test.zip
Could be related to https://bugzilla.gnome.org/show_bug.cgi?id=704071 .
Fixed with the following commit: https://git.gnome.org/browse/libxslt/commit/?id=05f70130433478c1075ce8b6fdc4c4dadf51d33e
Thank you, works fine!