W3C home > Mailing lists > Public > xmlschema-dev@w3.org > October 2012

Re: XSD 1.1: not okay to have an xs:assert at the attribute level?

From: Michael Kay <mike@saxonica.com>
Date: Wed, 17 Oct 2012 18:39:49 +0100
Message-ID: <507EED65.1090005@saxonica.com>
To: xmlschema-dev@w3.org, "Costello, Roger L." <costello@mitre.org>
Sorry for the delay in responding to this. It's a Saxon bug which I have 
logged at

https://saxonica.plan.io/issues/1637

and a patch will be in the next maintenance release. I am adding the 
test case to the W3C XSD 1.1 test suite.

Michael Kay
Saxonica


On 23/09/2012 12:55, Costello, Roger L. wrote:
> Hello Folks,
>
> For this XML document:
>
> <Test xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>      <Rule name="xsd:element" />
> </Test>
>
> I want an xs:assert element to test that the name attribute has the QName value xsd:element
>
> I placed the xs:assert inside the element declaration for Rule:
>
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>      
>      <xsd:element name="Test">
>          <xsd:complexType>
>              <xsd:sequence>
>                  <xsd:element name="Rule" maxOccurs="unbounded">
>                      <xsd:complexType>
>                          <xsd:attribute name="name" type="xsd:QName" use="required" />
>                          <xsd:assert test="@name eq xsd:QName('xsd:element')" />
>                      </xsd:complexType>
>                  </xsd:element>
>              </xsd:sequence>
>          </xsd:complexType>
>      </xsd:element>
>      
> </xsd:schema>
>
> I validated the XML document using SAXON 9.4 and got these two errors:
>
> (1) Namespace prefix {xsd} has not been declared
>
> (2) Element Rule does not satisfy assertion @name eq xsd:QName('xsd:element')
>
> I don't understand those errors. Clearly xsd has been declared and clearly Rule satisfies the XPath expression.
>
> Note that when I move the xs:assert up a level:
>
>      <xsd:element name="Test">
>          <xsd:complexType>
>              <xsd:sequence>
>                  <xsd:element name="Rule" maxOccurs="unbounded">
>                      <xsd:complexType>
>                          <xsd:attribute name="name" type="xsd:QName" use="required" />
>                      </xsd:complexType>
>                  </xsd:element>
>              </xsd:sequence>
>              <xsd:assert test="Rule/@name eq xsd:QName('xsd:element')" />
>          </xsd:complexType>
>      </xsd:element>
>
> then I get no error.
>
> Why is this?
>
> Is it not okay to have an xs:assert at the attribute level? If so, would you please refer me to the section in the specification that says this.
>
> /Roger
>
>
Received on Wednesday, 17 October 2012 17:40:16 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:16:02 UTC