Project

Profile

Help

Bug #1119

closed

Second predicate following // is erroneously evaluated

Added by Anonymous almost 15 years ago. Updated about 12 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
XPath conformance
Sprint/Milestone:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Legacy ID:
sf-2796626
Applies to branch:
Fix Committed on Branch:
Fixed in Maintenance Release:
Platforms:

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

saxon_bug.xsl (9.56 KB) saxon_bug.xsl Anonymous, 2009-05-25 23:18

Please register to edit this issue

Also available in: Atom PDF