NVDL and custom XHTML 5
Post here issues about NVDL, not specifically linked to the oNVDL implementation.
NVDL and custom XHTML 5
I'm an XML beginner so bare with me.
From what I understand by searching in the forums XHTML Validation is done using NVDL schema
e.g role attribute can only have values: x|y|z
if I'm not mistaken there is no .xsd for XHTML 5 available so this could possibly be achieved by learning Relax NG Compact.
What would be a good way of doing this - should I be editing the already existing rnc files?
From what I understand by searching in the forums XHTML Validation is done using NVDL schema
Among other things I'm looking for a way to customize the available attributes and their values for the "section" element in XHTML 5
Oxygen uses the following NVDL schema to provide validation and content completion for XHTML 5 documents:
OXYGEN_INSTALL_DIR/frameworks/xhtml/xhtml5 (epub3)/epub-xhtml-30.nvdl
e.g role attribute can only have values: x|y|z
if I'm not mistaken there is no .xsd for XHTML 5 available so this could possibly be achieved by learning Relax NG Compact.
What would be a good way of doing this - should I be editing the already existing rnc files?
Re: NVDL and custom XHTML 5
Hi Ari,
Indeed the main schema for editing XHTML 5 documents is located here:
OXYGEN_INSTALL_DIR\frameworks\xhtml\xhtml5 (epub3)\epub-xhtml-30.nvdl
It's a schema we copied from the EpubCheck open source EPUB checker project.
NVDL schemas basically can use multiple schemas in multiple contexts to validate certain parts of an XML document.
If you look inside the NVDL schema, besides its reference to the epub-xhtml-30.rnc Relax NG compact schema, it also has a reference to a Schematron schema.
You can also add an additional reference to your own Schematron schema like:
and your custom.sch can have the content:
Whenever the user will insert a different value for @role Oxygen will show a validation error.
If you also want those allowed values to be proposed in the content completion window as valid entries when the user inserts the @role attribute you will need to make the change to the Relax NG compact schemas. The "role" attribute is defined in this RNC file:
OXYGEN_INSTALL_DIR/frameworks/xhtml/xhtml5 (epub3)/mod/html5/html5-aria-30.rnc
and you can change its definition to:
The downside is that all @role attributes on all elements will be restricted (not only the ones for <section>). If you want only to influence role attribute values for <section>, you need to make more drastic changes to the schemas.
Regards,
Radu
Indeed the main schema for editing XHTML 5 documents is located here:
OXYGEN_INSTALL_DIR\frameworks\xhtml\xhtml5 (epub3)\epub-xhtml-30.nvdl
It's a schema we copied from the EpubCheck open source EPUB checker project.
NVDL schemas basically can use multiple schemas in multiple contexts to validate certain parts of an XML document.
If you look inside the NVDL schema, besides its reference to the epub-xhtml-30.rnc Relax NG compact schema, it also has a reference to a Schematron schema.
You can also add an additional reference to your own Schematron schema like:
Code: Select all
<validate schema="custom.sch" useMode="attach"/>
Code: Select all
<schema xmlns="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
<ns uri="http://www.w3.org/1999/xhtml" prefix="h"/>
<pattern>
<rule context="h:section">
<assert test="@role='X' or @role='Y' or @role='Z'">The @role attribute should have values X Y and Z</assert>
</rule>
</pattern>
</schema>
If you also want those allowed values to be proposed in the content completion window as valid entries when the user inserts the @role attribute you will need to make the change to the Relax NG compact schemas. The "role" attribute is defined in this RNC file:
OXYGEN_INSTALL_DIR/frameworks/xhtml/xhtml5 (epub3)/mod/html5/html5-aria-30.rnc
Code: Select all
aria.role.attr = attribute role { datatype.NMTOKENS }
Code: Select all
aria.role.attr = attribute role { 'X' | 'Y' | 'Z' }
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Return to “General NVDL Issues”
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