Using SQF on Schematron files
Posted: Wed Jun 29, 2022 3:06 am
I'm trying to create a Schematron Quickfix to enforce the authoring standards on our Schematron files. Works great until I needed to add a schematron element because the SQF can't tell the element I was trying to add wasn't just Schematron needing evaluation. Example, the following (obviously wrong) SQF rule tries to add a element <sch:value-of select='$DIAGNOSTIC_FOOTER'> into the schematron document being fixed (in bold below), but of course it just gets evaluated because it's schematron. I know t XSLT uses a namespace-alias for this sort of thing, what's the approach in this case?
Thanks Scott
<sch:pattern id="sqf-add-diag-ft">
<sch:rule context="sch:assert | sch:report">
<sch:assert test="sch:value-of[@select = '$DIAGNOSTIC_FOOTER']" sqf:fix="sqf-add-diag-ft" role="error" id="sch0004"><sch:name/> should have value-of for the diagnostic footer .</sch:assert>
<sch:let name="var-name" value="'$DIAGNOSTIC_FOOTER'"></sch:let>
<sqf:fix id="sqf-add-diag-ft">
<sqf:description>
<sqf:title>Add diagnostic footer</sqf:title>
</sqf:description>
<sqf:add position="last-child" xml:space="preserve">
<sch:value-of select="$var-name"/></sqf:add>
</sqf:fix>
</sch:rule>
</sch:pattern>
Thanks Scott
<sch:pattern id="sqf-add-diag-ft">
<sch:rule context="sch:assert | sch:report">
<sch:assert test="sch:value-of[@select = '$DIAGNOSTIC_FOOTER']" sqf:fix="sqf-add-diag-ft" role="error" id="sch0004"><sch:name/> should have value-of for the diagnostic footer .</sch:assert>
<sch:let name="var-name" value="'$DIAGNOSTIC_FOOTER'"></sch:let>
<sqf:fix id="sqf-add-diag-ft">
<sqf:description>
<sqf:title>Add diagnostic footer</sqf:title>
</sqf:description>
<sqf:add position="last-child" xml:space="preserve">
<sch:value-of select="$var-name"/></sqf:add>
</sqf:fix>
</sch:rule>
</sch:pattern>