Project

Profile

Help

Bug #5754

closed

SXST0060 Component cannot be streamed, although it is guaranteed streamable

Added by Michael Kay about 1 year ago. Updated 10 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Streaming
Sprint/Milestone:
-
Start date:
2022-12-04
Due date:
% Done:

100%

Estimated time:
Legacy ID:
Applies to branch:
10, 11, trunk
Fix Committed on Branch:
10, 11, trunk
Fixed in Maintenance Release:
Platforms:
.NET, Java

Description

See https://saxonica.plan.io/boards/3/topics/9150

Created XSLT3 test case si-value-of-102.

Actions #1

Updated by Michael Kay about 1 year ago

I suspect the situation that's a little unusual here is that the compiled xsl:value-of expression, although it only accesses attribute nodes, includes an EmptyTextNodeRemover. Normally this would be eliminated by type analysis determining that no text nodes can be selected, but this has been thwarted by the conditional "else 'default'" which gives the expression a heterogenous type.

If we replace "else 'default'" with "else ()", the stylesheet runs correctly.

There seem to be two possible ways forward: we could get smarter about the type analysis, enabling the EmptyTextNodeRemover to be eliminated, or we could get smarter about the streamability analysis of an EmptyTextNodeRemover. (Or we could do both...)

Actions #2

Updated by Michael Kay about 1 year ago

More specifically, the xsl:value-of select block initially generates a MergeAdjacentTextNodes expression. Further analysis shows that only one of the subexpressions (the if expression) is capable of generating text nodes, therefore adjacent text nodes cannot occur, therefore the MergeAdjacentTextNodes expression can be replaced with the simpler EmptyTextNodeRemover expression.

Note that the code also works without failure if we change the conditional

 if (normalize-space(@att3)) then @att3 else 'default'

to

 if (normalize-space(@att3)) then data(@att3) else 'default'
Actions #3

Updated by Michael Kay about 1 year ago

I've added more careful type analysis to AdjacentTextNodeMerger. If any of the operands is a Block or a Choose (conditional expression) it now examines the operands to see if any of them can be a text node, and if they can't, then the filter for text nodes can be eliminated. This solves the problem for this test case, though it's probably not a universal solution.

Actions #4

Updated by Michael Kay about 1 year ago

In fact there's a simpler way of improving the type inference - in place of getItemType(), use getStaticUType(), which also has the advantage that it follows more closely the type inference rules in the XSLT streamability spec. Only snag is that we haven't implemented getStaticUType for the Atomiser class, but this is easily fixed.

Actions #5

Updated by Michael Kay about 1 year ago

This fix causes test case streamable-033 to fail.

This is caused by the fact that CopyOf does not implement the method getStaticUType().

Perhaps it would be safer if the default implementation of getStaticUType() did getItemType().getUType()? But the results might not conform 100% with the W3C streamability rules.

Actions #6

Updated by Michael Kay about 1 year ago

  • Status changed from New to Resolved
  • Applies to branch 11, trunk added
  • Fix Committed on Branch 11, trunk added
  • Platforms .NET, Java added
Actions #7

Updated by Michael Kay about 1 year ago

  • Applies to branch 10 added
  • Fix Committed on Branch 10 added
Actions #8

Updated by Community Admin 11 months ago

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

Bug issue fix applied in the Saxon 12.0 Major Release. Leaving this bug marked as Resolved until fix applied

Actions #9

Updated by O'Neil Delpratt 10 months ago

  • Fixed in Maintenance Release 11.5 added

Bug fix applied in the Saxon 11.5 maintenance release.

Actions #10

Updated by O'Neil Delpratt 10 months ago

  • Status changed from Resolved to Closed
  • Fixed in Maintenance Release 10.9 added

Bug fix applied in the Saxon 10.9 maintenance release.

Please register to edit this issue

Also available in: Atom PDF