Project

Profile

Help

Bug #6092

closed

XSD: defaultOpenContent/@appliesToEmpty not working?

Added by Michael Kay over 1 year ago. Updated over 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Schema conformance
Sprint/Milestone:
-
Start date:
2023-06-23
Due date:
% Done:

100%

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

Description

To implement the rules for the proposed xsl:note element in the schema for XSLT 4.0, I am using a defaultOpenContent declaration with appliesToEmpty=true. This doesn't appear to be working: test case note-007, which has an xsl:noteelement as a child ofxsl:strip-space`, is rejected as invalid.

Summary

defaultOpenContent with appliesToEmpty=true is not working in the case of a complex type with a locally empty content model that is derived by extension from another complex type with a locally empty content model; the resulting type is classified (and validated) as empty without taking the openContent into account.

Actions #1

Updated by Michael Kay over 1 year ago

I checked that there are tests in this area, e.g. open-040 et seq in the Saxon test contributions; so it's not something that's completely untested or unimplemented, although it's certainly not widely used.

Actions #2

Updated by Michael Kay over 1 year ago

I think that the problem is around UserComplexType line 1947 where it does

                    if (contentModel.isEmpty()) {
                        extendedParticle = null;
                        if (variety == ComplexVariety.ELEMENT_ONLY) {
                            variety = ComplexVariety.EMPTY;
                        }
                    }

to set the content model to empty when it finds that a complex type derived by extension and its base type both have empty content models. I suspect it shouldn't be doing this if there is an open content wildcard that applies to empty elements.

Actions #3

Updated by Michael Kay over 1 year ago

Indeed, this appears to fix the problem. Change if (contentModel.isEmpty()) in this code to

if (contentModel.isEmpty() && (openContentWildcard == null || !openContentAppliesToEmpty))

so that the content model remains ELEMENT_ONLY rather than EMPTY if there is an open content wildcard.

Actions #4

Updated by Michael Kay over 1 year ago

  • Description updated (diff)
Actions #5

Updated by Michael Kay over 1 year ago

  • Status changed from New to Resolved
  • Applies to branch 11, 12, trunk added
  • Fix Committed on Branch 11, 12, trunk added
Actions #6

Updated by Michael Kay over 1 year ago

  • Description updated (diff)
Actions #7

Updated by O'Neil Delpratt over 1 year ago

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

Bug fix applied in the Saxon 12.3 maintenance release.

Actions #8

Updated by O'Neil Delpratt over 1 year ago

  • Status changed from Closed to Resolved

Leaving this bug issue as resolved until resolved against Saxon 11.

Actions #9

Updated by Debbie Lockett over 1 year ago

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

Bug fix applied in the Saxon 11.6 maintenance release.

Please register to edit this issue

Also available in: Atom PDF