After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 704071 - use-attribute-sets, inside attribute-set tag, not given the right import precedence
use-attribute-sets, inside attribute-set tag, not given the right import prec...
Status: RESOLVED FIXED
Product: libxslt
Classification: Platform
Component: general
1.1.x
Other Linux
: Normal major
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2013-07-12 08:46 UTC by Stefan Knorr
Modified: 2016-06-21 12:23 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Testcase (826 bytes, application/x-gzip)
2013-07-12 08:46 UTC, Stefan Knorr
Details
Simplified test case (718 bytes, application/x-compressed-tar)
2016-03-22 12:55 UTC, Stefan Knorr
Details

Description Stefan Knorr 2013-07-12 08:46:44 UTC
Created attachment 248991 [details]
Testcase

I have the issue that I want to override a few attributes defined in the original DocBook stylesheets with my customisation.
However, how I want to define the attribute is dependant on another factor, so I chose to use another xsl:attribute-set (in the testcase "sans.bold"), and then import its attributes into the one that is defined both in DocBook and in my customisation (in the testcase, "admonition.title.properties").

The problem is, that xsltproc seems to use the following import precendence rules:

#1 attributes defined directly in my customisation
   (as you can see in the testcase, it does font-size="30pt")

#2 attributes defined by the original DocBook stylesheets
   (it uses font-weight="bold")

#3 attributes defined in the "use-attribute-setted" attribute-set
   (it does import the line-height="1.2em")

To reproduce, 
* install the DocBook stylesheets (I'm using 1.78.0)
* untar the attached Testcase in some folder
* run $ xsltproc testcase.xsl testcase.xml
* check the block around the text "The font-weight value[…]" in the output
Comment 1 Stefan Knorr 2013-07-12 08:53:56 UTC
Also, I am using:

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

Packages:
* libxml2-tools-2.9.0-2.9.1.x86_64
* libxslt-tools-1.1.28-3.4.1.x86_64


Also: Using Saxon 6, I get the expected result, that is:

#1 attributes defined directly in my customisation
   (as you can see in the testcase, it does font-size="30pt")

#2 attributes defined in the "use-attribute-setted" attribute-set
   (it does import the line-height="1.2em")

#3 attributes defined by the original DocBook stylesheets
   (it uses font-weight="bold")
Comment 2 Stefan Knorr 2013-07-12 09:25:49 UTC
The parts of the XSLT spec regarding import precedence & attribute sets:
  http://www.w3.org/TR/xslt#dt-import-precedence
  http://www.w3.org/TR/xslt#attribute-sets


[Final NB: the last part of comment 1 lists the rules that are expected & apparently used by Saxon in the correct order, but the explanation of #3 in parentheses is of course wrong, as that value should not be used at all.]
Comment 3 Stefan Knorr 2016-03-22 12:55:34 UTC
Created attachment 324537 [details]
Simplified test case

Created a simplified test case, so you don't have to have the DocBook machinery installed too.
Comment 4 Nick Wellnhofer 2016-06-21 12:23:59 UTC
Fixed with the following commit:

https://git.gnome.org/browse/libxslt/commit/?id=ca9edf237f9925de4af809f0d5a0ed7e55bb6c82