Integrating SQF in a FrameworkHistory | Edit
You can use Schematron Quick Fixes to assist your content authors by imposing rules for an entire framework (document type) and offering fixes when a rule violation is detected.
For example, if you are using DITA, you may want your contributors to avoid inserting a
figure (fig element) inside a paragraph (p element) that
contains other content since it may result in undesirable placement or spacing in the output.
The Schematron rule and its Quick Fix for this particular use-case could look like this:
<schema xmlns="http://purl.oclc.org/dsdl/schematron" xmlns:sqf="http://www.schematron-quickfix.com/validator/process" queryBinding="xslt2"> <pattern id="check.figure.location"> <rule context="p/fig"> <report test="true()" role="warn" sqf:fix="moveAfter"> A figure inside a paragraph doesn't transform well into PDF. </report> <sqf:fix id="moveAfter"> <sqf:description> <sqf:title>Move after the paragraph.</sqf:title> </sqf:description> <let name="figToMove" value="."/> <sqf:add match="parent::p" select="$figToMove" position="after"/> <sqf:delete match="."/> </sqf:fix> </rule> </pattern> </schema>
The result of this example would be that the user will see a warning if they insert a
fig element inside a p element and they are presented with
the option of selecting the Quick Fix that would move the figure outside the paragraph.
How to Integrate SQF in a Framework
- Define a Schematron Quick Fix for a rule in an existing or new Schematron file.
- Save it somewhere in your framework directory. For example, the default framework directory for DITA is located in: [OXYGEN_INSTALL_DIR]/frameworks/dita/.
- Add a reference to the Schematron file that includes the SQF in your framework by following the procedure in Associating a Schema in Validation Scenarios Defined in the Document Type.
- Open a document in your framework and test the new rule and quick fix.
- You can continue to refine the rule and develop additional rules as needed.