Embedded schematron: problem with pattern/@name and value-of

This should cover W3C XML Schema, Relax NG and DTD related problems.
Patrik
Posts: 228
Location: Hamburg/Germany

Embedded schematron: problem with pattern/@name and value-of

Fri Feb 28, 2014 9:48 am

Hi,

i just changed to oxygen 15.2 and got now errors within my xsd-embedded schemtron rules:
  • [Schematron 1.5] cvc-complex-type.4: Attribute 'name' must appear on element 'sch:pattern'
  • [Schematron 1.5] cvc-complex-type.2.4.a: Invalid content was found starting with element '{"http://www.ascc.net/xml/schematron":value-of}'. One of '{"http://www.ascc.net/xml/schematron":name, "http://www.ascc.net/xml/schematron":emph, "http://www.ascc.net/xml/schematron":dir, "http://www.ascc.net/xml/schematron":span, WC[##other:"http://www.ascc.net/xml/schematron",""]}' is expected.

Wht did I do wrong? I think this should'n be errors and in 15.0 and 15.1 it works well.

example causing both erors:

Code: Select all

   
   <xs:element name="draft-comment" substitutionGroup="StandardInlineElement">
      <xs:complexType>
         <xs:annotation>
            <xs:appinfo>
               <sch:pattern>
                  <sch:rule context="draft-comment">
                     <sch:report test="true()" role="warn">
                        draft-comment: '<sch:value-of select="string-join(.//text()[not(matches(., '^\s+$'))], '')"/>'
                     </sch:report>
                  </sch:rule>
               </sch:pattern>
            </xs:appinfo>
         </xs:annotation>
         <xs:complexContent>
            <xs:extension base="anyType">
               <!--<xs:attribute name="author"/>-->
               <!--<xs:attribute name="time"/>-->
               <xs:attribute name="class" fixed="- topic/draft-comment"/>
               <xs:attributeGroup ref="attlistSpacePreserve"/>
            </xs:extension>
         </xs:complexContent>
      </xs:complexType>
   </xs:element>


Thanks and regards,

Patrik
radu_pisoi
Posts: 327
Location: Craiova

Re: Embedded schematron: problem with pattern/@name and valu

Fri Feb 28, 2014 12:33 pm

Hello,

In oXygen 15.2 version we improved the validation of an XML document with a Schematron schema by also validating the Schematron schema. So the first step in the validation process is to validate the Schematron schema itself. If the schema is valid, then the XML document will be validated against the schema, otherwise you will see only the Schematron validation problems.

This is also true when the Schematron rules are embedded in XML Schema or RelaxNG schemas.

In your case, you are developing an ISO Schematron pattern but you are using the namespace for Schematron 1.5 for it. In the Schematron 1.5 specification the 'name' attribute is requested for 'pattern' element. Also the 'value-of' element is not available.

To switch between Schematron 1.5 and ISO Schematron you have to change the namespace of the Schematron elements as follows:
* use 'http://purl.oclc.org/dsdl/schematron' for ISO Schematron;
* use 'http://www.ascc.net/xml/schematron' for Schematron 1.5.

In oXygen 15.2, you can validate the embedded Schematron rules from the XML Schema by using the 'Validate XML Schema with embedded Schematron' validation scenario. To use it, you should associate the scenario with your opened XML Schema document by using the 'Configure the Validation Scenario(s)' action available from the toolbar. After you associate the scenario, you have to re-validate the XML Schema document to see also the problems related to the Schematron code.

Regards,
Radu
Radu Pisoi
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
Patrik
Posts: 228
Location: Hamburg/Germany

Re: Embedded schematron: problem with pattern/@name and valu

Fri Feb 28, 2014 1:40 pm

Hi Radu,

this solved my problem. Thanks again.

Patrik

Return to “XML Schemas”

Who is online

Users browsing this forum: No registered users and 0 guests