Support #5942
closedHandling of elements without text() child elements changed between 9.8.x.x and 9.9.x.x
0%
Description
If I have an XML document
* <EmptyDoc />*
and I perform the following test
*<xsl:if test="EmptyDoc/text()=''">*
that test is TRUE in 9.8.x.x but it is FALSE in 9.9.x.x and 11.5
I can see the reasoning behind the change (there is no text node so it cannot be equal to "") and I can see the impossibility in you changing this back after so much time but it is a bit of a headache for me given the 300+ services I am maintaining that could all suffer from this when I upgrade to a more current Saxon version.
Are there any pointers you could give me about how to handle this? Like:
- is there I flag I can provide that reinstates previous behaviour?
- what kind of statements also to look for?
Any help is really appreciated, thanks in advance
SaxonEE on Java
Files
Updated by Michael Kay over 1 year ago
If what you're saying is correct, then that would most definitely be a bug in 9.8. It seems a rather unlikely one, and certainly with a quick test using Saxon-HE 9.8.0.15, I can't reproduce it. I suspect something more subtle is going on. Perhaps you could put together a repro that demonstrates the problem, a test cases that produces different results under different releases?
One possible explanation might be, for example, that the input is supplied as a programmatically-constructed DOM tree in which there is a zero-length text node. That's something that the XDM data model used by XPath doesn't allow, and over time we might have become better at "repairing" it to be conformant. That's a wild guess, but I suspect that getting to the bottom of it is going to involve some set of specific circumstances like that.
Updated by Marijn Sanderse over 1 year ago
- File saxon-textnode.tgz saxon-textnode.tgz added
Constructing the repro taught me that the "problem" is indeed a bit different than I initially thought: in 9.8 and before it was possible to cast a string value to a node() and then get its value from the text() node. In that scenario $var/text()='' did return true and now return false.
See testTextNodeFromEmpty2() in MyTransformerTest in the attached reproducer.
That is not something I expect or hope you will solve so I will be cleaning up my xslt's
Updated by Michael Kay over 1 year ago
Thanks. I haven't been able to track down a specific issue here, but from what you're saying it looks as if Saxon 9.8 for
<xsl:variable name="x">
<xsl:value-of select="''"/>
</xsl:variable>
was incorrectly producing a document node containing a single empty text node child, rather than a document node with no children.
Updated by Michael Kay over 1 year ago
I've confirmed that the bug was present in 9.9.1.4 but was fixed in 9.9.1.5.
Unfortunately, that hasn't enabled me to locate the specific bug issue.
But out of insatiable curiosity I traced the execution in a 9.8 build, and found it was bug #4246.
Bug #4246 is documented as being fixed in 9.9.1.7 rather than 9.9.1.5 - that's because we found that 9.9.1.5 only contained a partial fix, it didn't solve it in the case of bytecode generation, and the full fix only came in 9.9.1.7.
Not that this information is useful to anyone, I'm afraid.
Please register to edit this issue