Project

Profile

Help

Bug #6117

closed

Transformation using memo functions fails if the source is an XdmDocument.asSource()

Added by Norm Tovey-Walsh 10 months ago. Updated 5 months ago.

Status:
Closed
Priority:
Low
Assignee:
Category:
Internals
Sprint/Milestone:
-
Start date:
2023-07-06
Due date:
% Done:

100%

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

Description

This is a strange one.

A transformation with an XsltTransformer fails. A transformation with an Xslt30Transformer fails if the source is a previously built XdmNode passed in with document.asSource(), but passes if the source is, for example, a SAXSource.

Actions #1

Updated by Norm Tovey-Walsh 10 months ago

I've added a unit test which demonstrates the bug: src/test/java/bugs/bug6117

Actions #7

Updated by Michael Kay 10 months ago

Around June 2022, we made changes to introduce the "durability" property of node trees, classifying them as durable or transient. The idea is that in a memo function cache, we avoid having the cache hold strong links to transient nodes; we do this in effect by holding the generateId of the node as the cache key rather than the node itself (that's a simplification, there are some optimisation tweaks).

The crash occurs because some tree implementations - in this case SpaceStrippedNode - are returning null for the getDurability() property.

To fix this I suggest (a) reviewing implementations of TreeInfo to check that they return a non-null value for the property, and (b) making the call in MemoFunction.substitute() resilient to getting a null value back,

Actions #8

Updated by Michael Kay 10 months ago

That's working fine on SaxonJ, but C# is fussy about not allowing an enumeration value to be null, so the transpilation is failing. I think I've solved this in the past by adding an extra value such as UNDEFINED to the enumeration.

Actions #9

Updated by Michael Kay 10 months ago

  • Subject changed from Transformation fails if the source is an XdmDocument.asSource() to Transformation using memo functions fails if the source is an XdmDocument.asSource()
  • Category set to Internals
  • Status changed from New to Resolved
  • Assignee set to Michael Kay
  • Fix Committed on Branch 12, trunk added
  • Platforms .NET, Java added
Actions #10

Updated by O'Neil Delpratt 5 months ago

  • Status changed from Resolved to Closed
  • % Done changed from 0 to 100
  • Fixed in Maintenance Release 12.4 added

Bug fix applied in the Saxon 12.4 maintenance release

Please register to edit this issue

Also available in: Atom PDF