Constraining DITA with xsd
Post here questions and problems related to editing and publishing DITA content.
-
- Posts: 280
- Joined: Thu Nov 28, 2013 9:32 am
- Location: Hamburg/Germany
- Contact:
Constraining DITA with xsd
Hi,
I'm trying to create a constraints on DITA - e.g. enforce <title> to be the first element of a section. While this was very simple to do with Relax NG I didn't manage to realize this with XSD.
Even the simple sample I found http://dita4practitioners.github.io/dit ... odule.html does not work since I'm getting a Saxon error:
Is there any known issue? Or can you maybe point me to any other sample or tutorial?
Thanks and regards,
Patrik
I'm trying to create a constraints on DITA - e.g. enforce <title> to be the first element of a section. While this was very simple to do with Relax NG I didn't manage to realize this with XSD.
Even the simple sample I found http://dita4practitioners.github.io/dit ... odule.html does not work since I'm getting a Saxon error:
I also found this tutorial http://oxygenxml.com/doc/m/dita1.2_spec ... n-xsd.html but it only removes an element. But this is not sufficient to force the title-element to be the firt child of a section!?Saxon-EE 9.6.0.7
fatal
Group p.content is not a valid restriction of the group that it redefines. Restricted type allows element u where the base type does not
Is there any known issue? Or can you maybe point me to any other sample or tutorial?
Thanks and regards,
Patrik
-
- Posts: 280
- Joined: Thu Nov 28, 2013 9:32 am
- Location: Hamburg/Germany
- Contact:
Re: Constraining DITA with xsd
Hi again,
I just managed to make it work. It appears that Saxon expects that groups that are extended in an xs:redefine to reference themselves. So the sample needs to look like this to work:
Patrik
I just managed to make it work. It appears that Saxon expects that groups that are extended in an xs:redefine to reference themselves. So the sample needs to look like this to work:
Code: Select all
<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:redefine schemaLocation="highlightOnlyPConstraintsInt.xsd">
<!-- constrain content of <p> element -->
<xs:group name="p.content">
<xs:choice>
<xs:group ref="p.content"/> <!-- reference original (empty) group to indicate the redefine as extension -->
<xs:group ref="p-highlight-only.content"/>
</xs:choice>
</xs:group>
</xs:redefine>
</xs:schema>
-
- Posts: 404
- Joined: Thu Aug 21, 2003 11:36 am
- Location: Craiova
- Contact:
Re: Constraining DITA with xsd
Post by radu_pisoi »
Hi,
I think that the XML Schema redefine feature requires to always refer the redefined component.
This requirement is implemented by both XML Schema validators: Saxon and Xerces.
I think that the XML Schema redefine feature requires to always refer the redefined component.
This requirement is implemented by both XML Schema validators: Saxon and Xerces.
Radu Pisoi
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
-
- Posts: 280
- Joined: Thu Nov 28, 2013 9:32 am
- Location: Hamburg/Germany
- Contact:
Re: Constraining DITA with xsd
I could find the relevant part in the spec and it basically says that when extending a group by xs:redefine indeed a reference to itself is required...
However, I still have a problem with my DITA constraints.
intermediate file 'my_commonTopicsConstraintModInt.xsd':
module file 'my_commonTopicsConstraintMod.xsd':
My topic schema including this module validates fine with Saxon as well as Xerces. And all the topics as well.
But when validating my DITA map using the DITA Map Manager I get these messages for each topic:
Any ideas?
Thanks and regards,
Patrik
However, I still have a problem with my DITA constraints.
intermediate file 'my_commonTopicsConstraintModInt.xsd':
Code: Select all
[...]
<xs:redefine schemaLocation="urn:oasis:names:tc:dita:xsd:topicMod.xsd:1.3">
<xs:group name="section.content">
<xs:sequence>
<!-- "clear" group content so we can then override it again in the next level of redefine. -->
</xs:sequence>
</xs:group>
</xs:redefine>
[...]
Code: Select all
[...]
<xs:redefine schemaLocation="my_commonTopicsConstraintModInt.xsd">
<xs:group name="section.content">
<xs:sequence>
<xs:group ref="section.content"/> <!-- reference orginal group to mark this redefine as extension. -->
<xs:group ref="title"/>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:group ref="basic.block"/>
<xs:group ref="draft-comment"/>
</xs:choice>
</xs:sequence>
</xs:group>
</xs:redefine>
[...]
But when validating my DITA map using the DITA Map Manager I get these messages for each topic:
I'm using oXygen 17.1.E [Xerces] rcase-Recurse.2: There is not a complete functional mapping between the particles.
E [Xerces] src-redefine.6.2.2: Group 'section.content' does not properly restrict the group it redefines; constraint violated: 'rcase-Recurse.2'.
Any ideas?
Thanks and regards,
Patrik
-
- Posts: 404
- Joined: Thu Aug 21, 2003 11:36 am
- Location: Craiova
- Contact:
Re: Constraining DITA with xsd
Post by radu_pisoi »
Hi Patrik,
Unfortunately, I don't have to much experience with XML Schema based DITA specialization.
I would suggest that you register and ask around on the Yahoo Groups DITA Users List. This list is monitored by many DITA specialists and consultants and maybe one of them already encountered this problem.
Unfortunately, I don't have to much experience with XML Schema based DITA specialization.
I would suggest that you register and ask around on the Yahoo Groups DITA Users List. This list is monitored by many DITA specialists and consultants and maybe one of them already encountered this problem.
Radu Pisoi
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
Return to “DITA (Editing and Publishing DITA Content)”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ Artificial Intelligence (AI Positron Assistant add-on)
- ↳ 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