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

This should cover W3C XML Schema, Relax NG and DTD related problems.
Patrik
Posts: 280
Joined: Thu Nov 28, 2013 9:32 am
Location: Hamburg/Germany
Contact:

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

Post by Patrik »

Hi,

i just changed to oxygen 15.2 and got now errors within my xsd-embedded schemtron rules: 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: 403
Joined: Thu Aug 21, 2003 11:36 am
Location: Craiova
Contact:

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

Post by radu_pisoi »

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: 280
Joined: Thu Nov 28, 2013 9:32 am
Location: Hamburg/Germany
Contact:

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

Post by Patrik »

Hi Radu,

this solved my problem. Thanks again.

Patrik
Post Reply