Hygenic MCE using Schematron

By Rick Jelliffe
March 12, 2009

In recent blogs I have been looking at aspects of extensions: the Markup Compatibility and Extension (MCE) standard and the kinds of constraints needed in order to allow documents that have extensions but which can play everywhere: Minimal Open Documents Using Standards: MODUS.

Here is a Schematron schema for the kinds of constraints I am suggesting would be appropriate:


<sch:pattern>
<sch:title>MCE elements must allow one standard alternative</sch:title>

<sch:rule context="mce:alternativeContent">
<sch:assert test="mce:choice[not(@mustUnderstand)][*]
or mce:fallback[not(@mustUnderstand)][*]">
Every alternative content section must have at least
one choice (or fallback) which is not marked by any
mustUnderstand attribute, and which is not empty.
</sch:assert>

<sch:assert test="not( @mustUnderstand)">
An alternative content element must have at least one
choice that does not require any extension namespaces.
</sch:assert>
</sch:rule>

<sch:rule context="mce:choice[not(@mustUnderstand)]//*
| mce:fallback[not(@mustUnderstand)]//*">
<sch:assert test="namespace() = 'allowed-ns-1'
or namespace() = 'allowed-ns-2' ... ">
A choice or fallback that has no mustUnderstand attribute
must only contain known elements at any level.
</sch:assert>
</sch:rule>

</sch:pattern>


You might also be interested in:

News Topics

Recommended for You

Got a Question?