I wanted to start a discussion thread where we can share useful Schematron checks for DITA authoring.
Here's a check that reports text elements that begin/end with spaces:
Code: Select all
<rule context="p|ph|codeph|filename|indexterm|xref|user-defined|user-input" role="warning">
<let name="firstNodeIsElement" value="node()[1] instance of element()"/>
<let name="lastNodeIsElement" value="node()[last()] instance of element()"/>
<report test="(not($firstNodeIsElement) and matches(.,'^\s',';j')) or (not($lastNodeIsElement) and matches(.,'\s$',';j'))">Textual elements should not begin or end with whitespace.</report>
</rule>
Code: Select all
<p><xref ...> provides more information on this.</p>