Project

Profile

Help

Bug #4969

Invalid schema-aware SEF (Invalid alpha code)

Added by Michael Kay 2 months ago. Updated about 2 months ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
Schema-Aware processing
Sprint/Milestone:
-
Start date:
2021-04-14
Due date:
% Done:

0%

Estimated time:
Legacy ID:
Applies to branch:
10, trunk
Fix Committed on Branch:
10, trunk
Fixed in Maintenance Release:

Description

Reported by email to support, with files available for download.

The failure occurs when loading a SEF file for a schema-aware stylesheet: it appears to contain a reference to an anonymous type whose name cannot be resolved.

Failure occurs in 10.5; it apparently worked in 9.9.1.8

test.xml (81 Bytes) test.xml Michael Kay, 2021-04-15 00:42
test.xsl (577 Bytes) test.xsl Michael Kay, 2021-04-15 00:42
config_run.xml (225 Bytes) config_run.xml Michael Kay, 2021-04-15 00:42
test.xsd (281 Bytes) test.xsd Michael Kay, 2021-04-15 00:42
config_compile.xml (213 Bytes) config_compile.xml Michael Kay, 2021-04-15 00:42

History

#1 Updated by Michael Kay 2 months ago

In the source XSLT, the variable declaration is:

                <xsl:variable as="element(test:e)" name="e">
			<xsl:copy-of select="$e" validation="strict" />
		</xsl:variable>

Saxon has inferred a type for the variable of element(test:e, (anonymous type)) and is trying to save this inferred type in the SEF file. But anonymous types have no reliable persistent name; certainly not one that will survive export of the schema to an SCM file followed by reloading.

Short of some kind of scheme that links the SEF to a schema (with change control to protect against it changing), I think we should be dropping the anonymous type from exported representation.

#2 Updated by Michael Kay 2 months ago

I'm wondering if we could introduce some kind of notation so that instead of

as='1NE nQ{http://www.example.com/test}e cQ{http://ns.saxonica.com/anonymous-type}e_anonymous_type_1_at_line_5_of_test.xsd'

we output

as='1NE nQ{http://www.example.com/test}e c~'

where the ~ means "the schema type corresponding to the declared type of the global element declaration Q{http://www.example.com/test}e".

But the simpler and safer fix is simply to drop the schema type from the alpha code if it's anonymous. It doesn't actually make a big difference: inferred type information is useful to the compiler, but it's not used very much (if at all) at run-time.

#3 Updated by Michael Kay 2 months ago

Uploading the data files for future reference as it's clearly "foo-bar" data with no sensitivity.

#4 Updated by Michael Kay about 2 months ago

  • Category set to Schema-Aware processing
  • Status changed from New to In Progress
  • Priority changed from Low to Normal

I've converted this to a JUnit test: s9apitests/TestXsltCompiler/testBug4969. It's working in 10.x but failing in 11.x for an unrelated reason:

Supplied static base URI  is not a valid URI
	at net.sf.saxon.trace.ExpressionPresenter.emitRetainedStaticContext(ExpressionPresenter.java:373)

caused by trying to export a stylesheet that has no known base URI. Fixed this to work like 10x - it will only fail when the static base URI is actually needed.

#5 Updated by Michael Kay about 2 months ago

  • Status changed from In Progress to Resolved
  • Applies to branch 10, trunk added
  • Fix Committed on Branch 10, trunk added

Fixed on the 10.x and 11.x branches. An anonymous schema type in the inferred content type of an element or attribute is no longer output to the SEF file.

Please register to edit this issue

Also available in: Atom PDF