Edit online

Defining Schematron Quick Fixes

You can define and customize Schematron Quick Fixes directly in the current Schematron file or in a separate Schematron file. The Schematron Quick Fixes are an extension of the Schematron language and they allow you to define fixes for Schematron error messages. You can reference the Quick Fixes using the @sqf:fix attribute inside the <assert> or <report> elements (for example: <assert test="title" sqf:fix="removeComments">Remove comments</assert>).

Defining a Schematron Quick Fix

The basics of a Schematron Quick Fix is defined by an ID, name, description, and the operations to be executed.
  • ID - Defined by the @id attribute from the <sqf:fix> element and must be unique in the current context. It is used to refer the Quick Fix from a <report> or <assert> element.
  • Name - The name of the Quick Fix is defined by the <sqf:title> element.
  • Description - Defined by the text in the paragraphs (<sqf:p>) of the <sqf:description> element.
  • Operations - The following basic types of operations (elements) are supported:
    • <sqf:add> Element - To add a new node or fragment in the document.
    • <sqf:delete> Element - To remove a node from the document.
    • <sqf:replace> Element - To replace a node with another node or fragment.
    • <sqf:stringReplace> Element - To replace text content with other text or a fragment.
Figure 1. Schematron Quick Fix Components

The assertion message that generates the Quick Fix is added as the <sqf:description> of the problem to be fixed. The <sqf:title> is presented as the name of the Quick Fix. The content of the paragraphs (<sqf:p>) within the <sqf:description> element are presented in the tooltip message when the Quick Fix is selected.

Additional Elements Supported in the Schematron Quick Fixes

<sqf:user-entry>
This element defines a value that must be set manually by the user. For more information, see User Entry SQF Operation.
<sqf:call-fix>
This element calls another Quick Fix within a Quick Fix. The called Quick Fix must be defined globally or in the same Schematron rule as the calling Quick Fix. A calling Quick Fix adopts the activity elements of the called Quick Fix and should not include other activity elements. You can also specify which parameters are sent by using the <sqf:with-param> child element.
<sqf:group>
Allows you to group multiple Quick Fixes and refer them from an <assert> or <report> element.
<sqf:fixes>
Is defined globally and contains global fixes and groups of fixes.
<sqf:copy-of>
Used to copy the selected nodes that are specified by the @select attribute. The element with its attribute is treated as an xsl:copy-of with a @select attribute, as defined in the XSLT specification.
<sqf:param>
Defines a parameter for a Quick Fix. If the parameter is defined as abstract then the type and default value should not be specified and the fix can be called from an abstract pattern that defines this parameter.

Other SQF Notes

Note: The sqf:default-fix attribute is ignored in Oxygen XML Editor.

For more details on editing Schematron Quick Fixes, go to: Schematron Quick Fix Specifications