Copy empty attribute using xsl:where-populated
Since version 10.0 the performance of some of our xslt's has decreased due to the removal of the "bulk" and "grafting" copying capabilities. To remedy this, we are more and more using maps. When reworking one of our xslt's, we notice that an empty attribute (with string-length() = 0) does not always appear in the (secondary) output file.
The uploaded zip file contains all necessary files to reproduce the problem with Saxon-EE 10.2.
The problem does not occur with Saxon-EE 18.104.22.168.
#1 Updated by Michael Kay 9 months ago
Confirmed that with 9.9, the expected name="" attribute is present on line 400 of the output, and with 10.2 it is absent; and that there are other similar differences in the output files. Which suggests, prima facie, that one of the releases is wrong (unless of course it turns out that the code is dependent on something that's not well-defined, like order of attributes).
This is a complex stylesheet and working out what it does, and where the difference arises, is a pretty large undertaking. Is there any chance of trying to reduce it to a simpler repro? Without having any idea what the data means or how it is being processed, this is quite hard to do. As I mention, there are legitimate reasons why two different processors can give different output.
#2 Updated by Michael Kay 9 months ago
The stylesheet is using the
xsl:where-populated instruction, and the implementation of this instruction changed in 10.0 so it has both pull-mode and push-mode implementations (in 9.9 it was always pull mode). Since the semantics of
xsl:where-populated examine whether an attribute value is zero-length, this certainly seems like an area to investigate.
#4 Updated by Michael Kay 9 months ago
No, the logic of
WherePopulatedOutputter.attribute() is wrong. It should only suppress an empty attribute when
level==0, that is, when an instruction in the sequence constructor contained within
xsl:where-populated directly delivers a parentless attribute node. It should not suppress empty attributes deeper in the tree.
#5 Updated by Michael Kay 9 months ago
- Category set to XSLT conformance
- Status changed from New to In Progress
- Assignee set to Michael Kay
- Applies to branch 10, trunk added
This change fixes the problem. Leaving open for now until the fix is applied to all relevant branches and a regression test is created.
Please register to edit this issue