Project

Profile

Help

Bug #2000

Failure with streaming of xsl:iterate

Added by Michael Kay over 2 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Streaming
Sprint/Milestone:
-
Start date:
2014-02-08
Due date:
% Done:

100%

Legacy ID:
Applies to branch:
Fix Committed on Branch:
Fixed in Maintenance Release:
Found in version:
9.5
Fixed in version:
9.5.1.5

Description

David Rudel reports on saxon-help list:

I'm having strange results when testing out streaming with xsl:iterate.

My source file looks like this.

<book>
<chapter>
<page>
<paragraph/>
<figure/>
<paragraph/>
</page>
<page>
<paragraph/>
<paragraph/>
<paragraph/>
</page>
</chapter>
</book>

When I do an xsl:iterate using:

<xsl:iterate select="descendant::element()[name(.)=('figure','paragraph')]">

I get expected behavior. (note that <figure> and <paragraph> elements are always siblings.

When I instead do this:
<xsl:iterate select="descendant::element()[name(.)=('page','paragraph')]">

Saxon gets lost.
No errors are reported.
I assume the problem is that some <paragraph> elements are children of <page> elements. However, my script does not use any information requiring the content of the <page> elements.

The script is basically:

&lt;xsl:iterate select="descendant::element()[name(.)=('page','paragraph')]"&gt;
&lt;xsl:text&gt;
&lt;/xsl:text&gt;
&lt;xsl:value-of select="name(.)"/&gt;
&lt;/xsl:iterate&gt;

I adapted the test as iterate-098 in the XSLT 3.0 test suite. It's working on the 9.6 snapshot but in 9.5 I get different symptoms, namely

java.lang.ClassCastException: net.sf.saxon.expr.XPathContextMinor cannot be cast to net.sf.saxon.expr.XPathContextMajor
at com.saxonica.stream.watch.IterateWatch.endSelectedParentNode(IterateWatch.java:166)
at com.saxonica.stream.watch.WatchManager.endElement(WatchManager.java:369)
at net.sf.saxon.event.StartTagBuffer.endElement(StartTagBuffer.java:274)

History

#1 Updated by Michael Kay over 2 years ago

I'm surprised by the symptom "no errors were reported"; I'm consistently getting the class cast exception when one node selected by a streaming xsl:iterate is a descendant of another node that was already selected. A patch is being committed on the 9.5 branch; the problem does not exist in the 9.6 branch.

#2 Updated by Michael Kay over 2 years ago

  • Status changed from New to Resolved

#3 Updated by O'Neil Delpratt over 2 years ago

  • Status changed from Resolved to Closed
  • % Done changed from 0 to 100
  • Fixed in version set to 9.5.1.5

Bug fix applied in Saxon maintenance release 9.5.1.5

Also available in: Atom PDF