You can customize Schematron Quick Fixes by editing them directly in the current Schematron file or in a separate 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 refer the quick fixes from the assert or report elements in the values of the sqf:fix attributes.

The assertion message that generates the quick fix is added as the description of the problem to be fixed. The title is presented as the name of the quick fix. The content of the paragraphs (p) within the description element are presented in the tooltip message when the quick fix is selected.
<schema xmlns="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2" xmlns:sqf="http://www.schematron-quickfix.com/validator/process"> <pattern> <rule context="*[@xml:lang]"> <report test="@xml:lang" sqf:fix="remove_lang"> The attribute "xml:lang" is forbidden.</report> <sqf:fix id="remove_lang"> <sqf:description> <sqf:title>Remove "xml:lang" attribute</sqf:title> </sqf:description> <sqf:delete match="@xml:lang"/> </sqf:fix> </rule> </pattern> </schema>
<schema xmlns="http://purl.oclc.org/dsdl/schematron" xmlns:sqf="http://www.schematron-quickfix.com/validator/process" queryBinding="xslt2"> <pattern> <rule context="title"> <report test="exists(ph)" sqf:fix="resolvePh" role="warn"> ph element is not allowed in title.</report> <sqf:fix id="resolvePh"> <sqf:description> <sqf:title>Change the ph element into text</sqf:title> </sqf:description> <sqf:replace match="ph"> <value-of select="."/> </sqf:replace> </sqf:fix> </rule> </pattern> </schema>
<?xml version="1.0" encoding="UTF-8"?> <sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" xmlns:sqf="http://www.schematron-quickfix.com/validator/process" queryBinding="xslt2"> <sch:pattern> <sch:rule context="text()"> <sch:report test="matches(., '[oO][xX]ygen')" sqf:fix="changeWord">The oXygen word is not allowed</sch:report> <sqf:fix id="changeWord"> <sqf:description> <sqf:title>Replace word with product</sqf:title> </sqf:description> <sqf:stringReplace regex="[oO][xX]ygen"><ph keyref="product"/></sqf:stringReplace> </sqf:fix> </sch:rule> </sch:pattern> </sch:schema>
<sqf:add position="last-child"> <row><xsl:text> </xsl:text> <entry>First column</entry><xsl:text> </xsl:text> <entry>Second column</entry><xsl:text> </xsl:text> </row><xsl:text> </xsl:text> </sqf:add>
<sqf:add node-type="element" target="codeblock" xml:space="preserve"> /* a long sample program */ Do forever Say "Hello, World" End</sqf:add>
<sqf:fix id="last" use-when="$colWidthSummarized - 100 lt $lastWidth" role="replace"> <sqf:description> <sqf:title>Subtract the excessive width from the last element.</sqf:title> </sqf:description> <let name="delta" value="$colWidthSummarized - 100"/> <sqf:add match="html:col[last()]" target="width" node-type="attribute"> <let name="newWidth" value="number(substring-before(@width,'%')) - $delta"/> <value-of select="concat($newWidth,'%')"/> </sqf:add> </sqf:fix>
You can apply Schematron Quick Fixes over the nodes from referred documents (referred using XInclude or external entities), and you can access them as nodes in your current document.
<sqf:add match="doc('keylist.xml')/KeyList" target="Key" node-type="element" select="Key2">
For more details on editing Schematron Quick Fixes, go to: Schematron Quick Fix Specifications