- From: Christophe Marchand <cmarchand@oxiane.com>
- Date: Mon, 12 Sep 2016 11:41:45 +0200
- To: George Bina <george@oxygenxml.com>, xmlschema-dev@w3.org
You are right, George, attribute value was always true. I've changed attribute definition by a xs:boolean restriction with a pattern 'true', and that works perfectly. Mikael, according to George response, this shouldn't work in Saxon, no ? Is there any ambiguous definition around @fixed attribute in xs:attribute ? Thanks to both of you, Christophe Le 12/09/2016 à 10:02, George Bina a écrit : > Hi, > > In your schema > > <xs:attribute name="traceActive" type="xs:boolean" fixed="true" > use="optional"/> > *** > The fixed attribute indicates that the attribute value if present must > equal the supplied constraint value, and if absent receives the > supplied value as for default. > *** > > will force the traceActive attribute to be available with the value > "true", even if it is not added explicitly to the XML document, thus > the assertion will fail on the first pipe element. > > Best Regards, > George > -- > George Cristian Bina > <oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger > http://www.oxygenxml.com > > On 12/09/16 09:24, Christophe Marchand wrote: >> Following your suggests, I still can not manage to make it run >> correctly. >> >> Attached is a simplified schema and a XML file that contains 4 samples : >> the 3 first are expected to be valid, the last one to be invalid. >> >> I use oXygen 17.0 on dev side, & xerces 2.12-beta-r1667115 on prod side. >> >> Thanks in advance for your help... >> >> Christophe >> >> >> >> Le 07/09/2016 à 10:55, Michael Kay a écrit : >>> The fact that you use cfg:TPipe to refer to the type is a clue that >>> the schema has a targetNamespace which you haven't shown us. This >>> would suggest that the pipe element is also in a namespace which you >>> haven't shown us, and if this is the case then my guess is that the >>> xslt element is also in a namespace, in which case the XPath >>> expression in the assertion needs to use a prefixed name to refer to >>> it (or to declare a default XPath namespace). >>> >>> Michael Kay >>> Saxonica >>> >>>> On 6 Sep 2016, at 17:21, Christophe Marchand <cmarchand@oxiane.com> >>>> wrote: >>>> >>>> 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 Monday, 12 September 2016 09:42:18 UTC