your XSD document specifies the concerned element declarations as follows, <xsd:element name="defocusU" type="defocusType" maxOccurs="1" minOccurs="0"/> <xsd:element name="defocusV" type="defocusType" maxOccurs="1" minOccurs="0"/>
which means that these elements are optional. Within your XML instance document, only the first <particle> element has the above element instances. Your assertion, <xsd:assert test="defocusU ge defocusV" /> succeeds on the <particle> which has the elements defocusU and defocusV but fails on the other <particle> elements. I think, the correct way to write your assertion would be, <xsd:assert test="if (defocusU and defocusV) then (defocusU ge defocusV) else true()" /> Which will take care of the optional nature of these elements. Since the complexType "defocusType" in your schema has simpleContent, therefore "ge" operator would work fine as you're expecting. On Mon, Apr 22, 2013 at 5:52 AM, Roberto Marabini <robe...@cnb.csic.es> wrote: > Hi, > > I am trying to write a XSD 1.1 schema that uses XSD 1.1 > assertions. I am able to repeat the examples described in the URL: > http://mukulgandhi.blogspot.com.es/2009/11/xsd-11-some-xsd-11-samples-running-with.html > so I guess my xerces-j installation is OK. > > When I tried to include an assert in my schema (I reproduce part of > it in the email and attach the full file) I got the error message: > > [Error] kk.emx:33:14: cvc-assertion.3.13.4.1: Assertion evaluation > ('defocusU ge defocusV') for element 'particle' with type '#anonymous' > did not succeed. > > but defocusU is indeed greater than defocusV > > Note that the commented lines > > <!-- <xsd:assert test="t34 le 3" />--> > <!-- <xsd:assert test="@index le 3" />--> > > work properly when uncommented > > but > > <xsd:assert test="defocusU ge defocusV" /> > > does not. I guess the problem is that defocusU and defocusV are complextypes > > any help will be welcomed > > thanks > > Roberto > ================= > > Schema > > <?xml version="1.1" encoding="UTF-8"?> > <xsd:schema elementFormDefault="qualified" > xmlns:xsd="http://www.w3.org/2001/XMLSchema"> > > ............... > ............... > .............. > > <xsd:element name="EMX"> > <xsd:complexType> > <xsd:sequence> > > <xsd:element name="micrograph" type="microType" > maxOccurs="unbounded" minOccurs="0"/> > > <xsd:element name="particle" maxOccurs="unbounded" minOccurs="0"> > <xsd:complexType> > <xsd:all> > <xsd:element name="defocusU" type="defocusType" > maxOccurs="1" minOccurs="0"/> > <xsd:element name="defocusV" type="defocusType" maxOccurs="1" > minOccurs="0"/> > <xsd:element name="defocusUAngle" type="angleType" > maxOccurs="1" minOccurs="0"/> > > > <xsd:element name="micrograph" maxOccurs="1" minOccurs="0"> > <xsd:complexType> > <xsd:simpleContent> > <xsd:extension base="xsd:string"> > <xsd:attribute name="fileName" > type="xsd:string" > use="required"/> > <xsd:attribute name="index" > type="xsd:integer"/> > </xsd:extension> > </xsd:simpleContent> > </xsd:complexType> > </xsd:element> > > <xsd:element name="activeFlag" > type="xsd:nonNegativeInteger" maxOccurs="1" minOccurs="0"/> > <xsd:element name="boxSize" maxOccurs="1" minOccurs="0"> > <xsd:complexType> > <xsd:all> > <xsd:element name="X" type="boxSizeType" > maxOccurs="1" > minOccurs="1"/> > <xsd:element name="Y" type="boxSizeType" > maxOccurs="1" > minOccurs="1"/> > </xsd:all> > </xsd:complexType> > </xsd:element> > > <xsd:element name="centerCoord" maxOccurs="1" minOccurs="0"> > <xsd:complexType> > <xsd:all> > <xsd:element name="X" type="coordType" > maxOccurs="1" minOccurs="1"/> > <xsd:element name="Y" type="coordType" > maxOccurs="1" minOccurs="1"/> > </xsd:all> > </xsd:complexType> > </xsd:element> > > <xsd:element name="fom" type="decimalBTzeroANDone" > maxOccurs="1" minOccurs="0"/> > <xsd:element name="pixelSpacing" maxOccurs="1" minOccurs="0"> > <xsd:complexType> > <xsd:all> > <xsd:element name="X" type="samplingType" > maxOccurs="1" > minOccurs="1"/> > <xsd:element name="Y" type="samplingType" > maxOccurs="1" > minOccurs="1"/> > </xsd:all> > </xsd:complexType> > </xsd:element> > > <xsd:element name="transformationMatrix" maxOccurs="1" > minOccurs="0"> > <xsd:complexType> > <xsd:all> > <xsd:element name="t11" type="xsd:double" > maxOccurs="1" > minOccurs="0"/> > <xsd:element name="t12" type="xsd:double" > maxOccurs="1" > minOccurs="0"/> > <xsd:element name="t13" type="xsd:double" > maxOccurs="1" > minOccurs="0"/> > <xsd:element name="t14" type="transformationType" > maxOccurs="1" minOccurs="0"/> > <xsd:element name="t21" type="xsd:double" > maxOccurs="1" > minOccurs="0"/> > <xsd:element name="t22" type="xsd:double" > maxOccurs="1" > minOccurs="0"/> > <xsd:element name="t23" type="xsd:double" > maxOccurs="1" > minOccurs="0"/> > <xsd:element name="t24" type="transformationType" > maxOccurs="1" minOccurs="0"/> > <xsd:element name="t31" type="xsd:double" > maxOccurs="1" > minOccurs="0"/> > <xsd:element name="t32" type="xsd:double" > maxOccurs="1" > minOccurs="0"/> > <xsd:element name="t33" type="xsd:double" > maxOccurs="1" > minOccurs="0"/> > <xsd:element name="t34" type="transformationType" > maxOccurs="1" minOccurs="0"/> > </xsd:all> > <!-- <xsd:assert test="t34 le 3" />--> > </xsd:complexType> > </xsd:element> > > </xsd:all> > <xsd:attribute name="fileName" type="xsd:string" > use="required"/> > <xsd:attribute name="index" type="xsd:integer"/> > <!-- <xsd:assert test="@index le 3" />--> > <xsd:assert test="defocusU ge defocusV" /> > </xsd:complexType> > </xsd:element> > > </xsd:sequence> > <xsd:attribute name="version" type="numVersion" use="required"/> > </xsd:complexType> > </xsd:element> > > </xsd:schema> -- Regards, Mukul Gandhi --------------------------------------------------------------------- To unsubscribe, e-mail: j-users-unsubscr...@xerces.apache.org For additional commands, e-mail: j-users-h...@xerces.apache.org