W3C home > Mailing lists > Public > xmlschema-dev@w3.org > September 2016

Simple assert on descendant nodes does not throw error

From: Christophe Marchand <cmarchand@oxiane.com>
Date: Tue, 6 Sep 2016 18:21:22 +0200
To: xmlschema-dev@w3.org
Message-ID: <74836bd8-45cc-f95b-1d5e-ecaf98f7864a@oxiane.com>
Hello,

I've just added a simple assert to my schema, and I can not get errors 
validating wrong documents. I can nto find why.
Any help will be much appreciated...

Best,
Christophe

My schema :
     <xs:complexType name="TPipe">
         <xs:sequence>
             <xs:choice maxOccurs="unbounded">
                 <xs:element name="xslt" />
                 ...
             </xs:choice>
         </xs:sequence>
         <xs:attribute name="nbThreads" type="xs:integer" default="1" 
use="optional"/>
         <xs:attribute name="mutiThreadMaxSourceSize"/>
         <xs:attribute name="traceOutput" type="xs:string"/>
         <xs:assert test="if(not(./@traceOutput)) then 
empty(descendant::xslt[@traceActive='true']) else true()"/>
     </xs:complexType>
     <xs:element name="pipe" type="cfg:TPipe"/>

The document I expect an error to be thrown for :
     <pipe nbThreads="1" mutiThreadMaxSourceSize="" >
                 <xslt href="src/test/resources/identity.xsl" 
traceActive="true"/>
                 <output id="pipe1" >
                     <folder absolute="./target/generated-test-files"/>
                     <fileName name="${basename}-pipe1.xml"/>
                 </output>
     </pipe>
Received on Wednesday, 7 September 2016 07:27:32 UTC

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