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 533334 - Wrong conflict resolution for template rules
Wrong conflict resolution for template rules
Status: RESOLVED OBSOLETE
Product: libxslt
Classification: Platform
Component: general
1.1.x
Other All
: Normal critical
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2008-05-15 20:25 UTC by Sergiy Kolesnikov
Modified: 2021-07-05 11:00 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Sergiy Kolesnikov 2008-05-15 20:25:49 UTC
Please describe the problem:
xsltproc produces wrong output due to the wrong conflict resolution for template rules.

Steps to reproduce:
1. Take the following Stylesheet
---
<?xml version="1.0" encoding="UTF-8"?>
<!-- transformation of the calloutlist element -->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

  <xsl:template match="text()">
  </xsl:template>

  <xsl:template match="@*|node()">
    <xsl:copy>
      <xsl:apply-templates/>
    </xsl:copy>
  </xsl:template>
  
</xsl:stylesheet>

---
2. Take the following XML file
---
<?xml version="1.0" encoding="UTF-8"?>
<winelist>
  <wine grape="Chardonnay">
    <winery>Benziger</winery>
    <product>Carneros</product>
  </wine>
</winelist>
---
3. Run xsltproc with them.


Actual results:
xsltproc's output is:
---
<?xml version="1.0"?>
<winelist>
  <wine>
    <winery/>
    <product/>
  </wine>
</winelist>
---

Expected results:
The following output is expected:
---
<?xml version="1.0" encoding="UTF-8"?><winelist>
  <wine>
    <winery>Benziger</winery>
    <product>Carneros</product>
  </wine>
</winelist>
---

Does this happen every time?
yes

Other information:
I uesed libxslt 1.1.23.

The described behavior of the xsltproc violates the conflict resolution rule described in the last paragraph of the Chapter 5.5 in the XSL Transformations W3C Specification.

Just to be safe I tested the same Stylesheet and XML file with xalanj and 4xslt. All of them produce the expected output.
Comment 1 ruv 2008-08-30 17:53:09 UTC
I confirm this bug.

In accordance to "Conflict Resolution for Template Rules" http://www.w3.org/TR/xslt11/#conflict
  The text() pattern and the node() pattern are the same weight (priority is 0.5), and
  — "It is an error if this leaves more than one matching template rule, an XSLT processor may signal the error; if it does not signal the error, it must recover by choosing, from amongst the matching template rules that are left, the one that occurs last in the stylesheet"

So, XSLT proccesr must either signal error or use a template that occurs last in the stylesheet.

Comment 2 GNOME Infrastructure Team 2021-07-05 11:00:16 UTC
GNOME is going to shut down bugzilla.gnome.org in favor of gitlab.gnome.org.
As part of that, we are mass-closing older open tickets in bugzilla.gnome.org
which have not seen updates for a longer time (resources are unfortunately
quite limited so not every ticket can get handled).

If you can still reproduce the situation described in this ticket in a recent
and supported software version, then please follow
  https://wiki.gnome.org/GettingInTouch/BugReportingGuidelines
and create a new ticket at
  https://gitlab.gnome.org/GNOME/libxslt/-/issues/

Thank you for your understanding and your help.