schema aware schematron in xsd
This should cover W3C XML Schema, Relax NG and DTD related problems.
-
- Posts: 280
- Joined: Thu Nov 28, 2013 9:32 am
- Location: Hamburg/Germany
- Contact:
schema aware schematron in xsd
Hi,
I have added soem schematron rules within my xsd. Now with growing complexity it appears that I use the same element name twice and it might happen that a schematron rules matches the second element as well which it shouldn't. Now my idea is to use schema-element or element(*, myType) as pattern to ensure I match only the specific element.
Of course this requires an xsl:import-schema and i made it work within a schematron file. However, I can't get it work with xsd embedded scheamtron. I keep getting the message
XPST0008 XSLT Pattern syntax error at char 11 on line 26 in {element(*, digitsType)}: No schema has been imported for namespace ''
my test schema looks like this:
I guess when extracting the schematron code from the xsd it only considers sch:pattern and simply ignores the xsl:import-schema. Is there any way to make this work? (I already tried to use sch:include but this seems to be ignored as well.)
I have added soem schematron rules within my xsd. Now with growing complexity it appears that I use the same element name twice and it might happen that a schematron rules matches the second element as well which it shouldn't. Now my idea is to use schema-element or element(*, myType) as pattern to ensure I match only the specific element.
Of course this requires an xsl:import-schema and i made it work within a schematron file. However, I can't get it work with xsd embedded scheamtron. I keep getting the message
XPST0008 XSLT Pattern syntax error at char 11 on line 26 in {element(*, digitsType)}: No schema has been imported for namespace ''
my test schema looks like this:
Code: Select all
<xs:schema
xmlns:xs = "http://www.w3.org/2001/XMLSchema"
xmlns:sch = "http://purl.oclc.org/dsdl/schematron"
xmlns:xsl = "http://www.w3.org/1999/XSL/Transform"
elementFormDefault="qualified">
<xs:annotation>
<xs:appinfo>
<xsl:import-schema schema-location="Schema.xsd"/>
</xs:appinfo>
</xs:annotation>
<xs:element name="root">
<xs:complexType>
<xs:sequence>
<xs:element name="digits" type="digitsType" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:simpleType name="digitsType">
<xs:annotation>
<xs:appinfo>
<sch:pattern>
<!--<sch:rule context="digits">-->
<sch:rule context="element(*, digitsType)">
<sch:assert test="matches(text(), '^[0-9]+$')">
The <sch:value-of select="name()"/>-element must contain only digits. (xsd)
</sch:assert>
</sch:rule>
</sch:pattern>
</xs:appinfo>
</xs:annotation>
<xs:restriction base="xs:string"/>
</xs:simpleType>
</xs:schema>
-
- Posts: 280
- Joined: Thu Nov 28, 2013 9:32 am
- Location: Hamburg/Germany
- Contact:
Re: schema aware schematron in xsd
I managed to make it work by modifying the schematron xslt scripts. If someone is interested I'd gladly share the code. (Some more modifications were neccessary.)
It might as well me a nice feature to add "schema aware" as a schematron configuration parameter to oxygen.
Regards,
Patrik
It might as well me a nice feature to add "schema aware" as a schematron configuration parameter to oxygen.
Regards,
Patrik
-
- Site Admin
- Posts: 2095
- Joined: Thu Jan 09, 2003 2:58 pm
Re: schema aware schematron in xsd
Hi Patrick,
I think this comes down to copying the embedded XSLT together with the embedded Schematron when the Schematron rules are extracted from the XSD or Relax NG schema.
We plan to support this as well - but it will work only if allowForeign is set to true, otherwise the foreign elements (other than Schematron) will be discarded when the Schematron schema is converted to XSLT.
Best Regards,
George
I think this comes down to copying the embedded XSLT together with the embedded Schematron when the Schematron rules are extracted from the XSD or Relax NG schema.
We plan to support this as well - but it will work only if allowForeign is set to true, otherwise the foreign elements (other than Schematron) will be discarded when the Schematron schema is converted to XSLT.
Best Regards,
George
George Cristian Bina
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service