This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 20784 - A top-level xs:annotation in a schema that's being overridden causes override.xsl to fail
Summary: A top-level xs:annotation in a schema that's being overridden causes override...
Status: ASSIGNED
Alias: None
Product: XML Schema
Classification: Unclassified
Component: Structures: XSD Part 1 (show other bugs)
Version: 1.1 only
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: David Ezell
QA Contact: XML Schema comments list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-01-26 20:01 UTC by Norman Walsh
Modified: 2013-01-27 18:54 UTC (History)
2 users (show)

See Also:


Attachments
ZIP file containing schemas to reproduce the bug (1.85 KB, application/zip)
2013-01-26 20:01 UTC, Norman Walsh
Details

Description Norman Walsh 2013-01-26 20:01:06 UTC
Created attachment 1320 [details]
ZIP file containing schemas to reproduce the bug

If you create a schema that has a top-level xs:annotation and subsequently attempt to override that schema with an xs:override in another component, attempting to apply override.xsl will result in an error. The xs:annotation element doesn't have a name attribute and theat causes f:componentName to attempt to create a QName with an empty local name.

You can see this in action by attempting to validate 'sample.xml' with 'over.xsd' from the attached ZIP file.
Comment 1 Michael Kay 2013-01-27 00:04:20 UTC
I have added the test case as test Override/over030 in the Saxonica section of the XSD test suite, and I have reproduced the failure using Saxon. (It might be worth pointing out that the stylesheet Saxon uses internally differs slightly from that published in the spec, though at first sight I don't think the differences are material.)
Comment 2 Michael Kay 2013-01-27 18:54:43 UTC
I fixed this for Saxon by changing the f:componentName function to:

<xsl:function name="f:componentName" as="xs:QName?">
    <xsl:param name="component" as="element()"/>
    <xsl:sequence select="if ($component/@name) then QName($component/ancestor::xs:schema/@targetNamespace, $component/@name) else ()"/>
  </xsl:function>

And I also had to add an xs:import for the XML namespace to the overriding schema document.