Bug #1119
closedSecond predicate following // is erroneously evaluated
0%
Description
SourceForge user: elenz
The attached stylesheet should speak for itself. Run the stylesheet against itself to reproduce the problem.
Basically, when a second predicate follows "//", the second predicate is (apparently) being evaluated independently of the first. An implementation that computes the intersection of the two filtered results would normally be just fine, but not when independent evaluation results in a type error that otherwise wouldn't occur. (I'm only speculating here on the source of the bug.)
In the following expression, the my:name-att() function is apparently being called even for elements that don't have a "name" attribute. But the first predicate should prevent that from happening.
//*[@name][my:name-att(.)]
The type signature and return expression of my:name-att() is defined such that it won't be happy if you give it an element having no "name" attribute.
Given the above expression, I get this error (assuming that the source document has some elements that don't have a "name" attribute):
Error on line 9 of saxon_bug.xsl:
XTTE0780: An empty sequence is not allowed as the result of function my:name-att()
at my:name-att() (file:///c:/buildx/script2/schemaSync/saxon_bug.xsl#16)
The following workarounds work for me (separate the two predicates into different steps):
//*[@name]/self::node()[my:name-att(.)]
//*/@name/..[my:name-att(.)]
I don't know if "//" is essential, but when I simply put "/" instead of "//", it did not exploit the bug.
Files
Please register to edit this issue