Project

Profile

Help

Bug #4029

closed

saxon:path() is broken in 9.9

Added by David Sewell about 6 years ago. Updated almost 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Saxon extensions
Sprint/Milestone:
-
Start date:
2018-11-15
Due date:
% Done:

100%

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

Description

I see that saxon:path() has been obsolete since fn:path() was introduced. However, it was working in 9.8 but appears to be entirely broken in 9.9 (Saxon-PE 9.9.0.2J) as I discovered when running an older XSLT transform. For the simple test files attached, 9.8 produces the expected message:

Found a nugget at /doc/p[3]/i[1]

while 9.9 outputs

Found a nugget at /doc/p187/i185

If it is not worth fixing perhaps it should simply be removed?


Files

test.xml (98 Bytes) test.xml saxon:path() test XML David Sewell, 2018-11-15 20:31
test.xsl (517 Bytes) test.xsl saxon:path() test XSLT David Sewell, 2018-11-15 20:31

Related issues

Has duplicate Saxon - Bug #4073: Invalid XPath expression in error messageDuplicateMichael Kay2018-12-19

Actions
Actions #1

Updated by T Hata about 6 years ago

Also I encountered a weird expression like that in an error message.

Error at char 9 in xsl:template/@match on line 44 column 82 of foo.xsl:
  XTTE0780: An error occurred matching pattern
  ...
  in built-in template rule for /html/body185/div186/div186/div187/div185/div185/div188/div185/div185 in the unnamed mode
  in built-in template rule for /html/body185/div186/div186/div187/div185/div185/div188/div185 in the unnamed mode
  in built-in template rule for /html/body185/div186/div186/div187/div185/div185/div188 in the unnamed mode
  in built-in template rule for /html/body185/div186/div186/div187/div185/div185 in the unnamed mode
  in built-in template rule for /html/body185/div186/div186/div187/div185 in the unnamed mode
  in built-in template rule for /html/body185/div186/div186/div187 in the unnamed mode
  in built-in template rule for /html/body185/div186/div186 in the unnamed mode
  in built-in template rule for /html/body185/div186 in the unnamed mode
  in built-in template rule for /html/body185 in the unnamed mode
  in built-in template rule for /html in the unnamed mode

Actions #2

Updated by Michael Kay about 6 years ago

  • Status changed from New to Resolved
  • Assignee set to Michael Kay
  • Priority changed from Low to Normal
  • Fix Committed on Branch 9.9 added

Interesting how this bug happened: the Saxon 9.8 code (in Navigator.getPath())

return pre + '/' + node.getDisplayName() + '[' + getNumberSimple(node, context) + ']'

became in 9.9

return pre + '/' + node.getDisplayName() + (streamed ? "" : '[' + getNumberSimple(node, context) + ']');

The change was made so that getPath() returns something useful when streaming (when sibling position is not available), but it fell foul of Java's silly overloading of the "+" operator (and implicit conversion of char to int).

In fact I think this change was made as part of a bug fix, and it's possible that it would have been revealed if we tested maintenance releases as thoroughly as we test major releases.

So, the fix is trivial. Thanks for reporting it.

Actions #3

Updated by Michael Kay about 6 years ago

I established that the only tests for saxon:path are in the so-called "original" test suite, consisting of old tests that we don't run very often because checking the results is a manual process. I will attempt to migrate them to xslt30extra.

Actions #4

Updated by Michael Kay about 6 years ago

Test case path-026 added to xslt30extra. This revealed that the first patch was inadequate; it only fixed the problem for element nodes, but the same problem was present for other node kinds.

Actions #5

Updated by Michael Kay almost 6 years ago

  • Has duplicate Bug #4073: Invalid XPath expression in error message added
Actions #6

Updated by O'Neil Delpratt almost 6 years ago

  • % Done changed from 0 to 100
  • Fixed in Maintenance Release 9.9.1.1 added

Bug fix applied to the Saxon 9.9.1.1 maintenance release.

Actions #7

Updated by O'Neil Delpratt almost 6 years ago

  • Status changed from Resolved to Closed

Please register to edit this issue

Also available in: Atom PDF