The <diagnostic> element enables the schema designer to compose error messages that are user-friendly.
Oftentimes the results of a validation are delivered to users who are not XML experts, or technology whizzes.
Rather, they are domain experts. Thus, the <diagnostic> element allows you to give users error messages
expressed in their own lingo, i.e., domain-specific diagnostics.
This is a very important and unique feature
of Schematron.
The <sch:diagnostics> Element
A Schematron schema is comprised of one or more <pattern> elements followed by an optional <diagnostics>
element.
The <diagnostics> element is comprised of one or more <diagnostic> elements.
Read as: this diagnostic has an identifier (invalid-security-label). When invoked, this diagnostic is to
output some text along with the value of the classification attribute of the current - context - node (Para), and
the value of the classification attribute of the <Document> element.
The <sch:value-of> Element
A <sch:value-of> element has the same functionality as the XSLT <xsl:value-of> element.
It has a select attribute that you use to identify a node in the document. The Schematron
tool will output the value of the node that is identified.
For example, the below <sch:value-of> element
says to output the value of the classification attribute on the current node:
<sch:value-of select="./@classification"/>
Associating Assertion to Diagnostic
You connect an assertion to a diagnostic.
The <assert> element has an optional diagnostics attribute. The value of the diagnostics attribute
is the value of a <diagnostic> element's id attribute.
Example: this assertion is connected to the diagnostic (shown two slides back):
Then, place the jar file into this folder: [oxygen]/lib/endorsed, where [oxygen] is the folder that where you installed Oxygen.
Note that the endorsed folder does not exist by default so you need to create it first.
The diagnostic message will appear when you hover your mouse over the message at the bottom of the Oxygen screen.