SQF for keydef + topicref attributes
Posted: Fri Apr 22, 2016 9:01 pm
Hello,
We have two similar rules, one works and one doesn't. Can you help?
This rule works. It highlights the <topicref> element when the @type attribute is specified but doesn't throw a warning otherwise.
This rule does not work. It will always throw a warning on any <keydef> element, even when the element does not have the @processing-role attribute specified.
Suggestions?
Also, we notice that sometimes the schematron rules only work when we add the processing instruction to associate the schema on the specific file, like this:
But we would prefer to associate the schema to all files in the Preferences > Document Type Association configuration.
Thanks for your help.
Take care,
- Nick
We have two similar rules, one works and one doesn't. Can you help?
This rule works. It highlights the <topicref> element when the @type attribute is specified but doesn't throw a warning otherwise.
Code: Select all
<sch:rule id="attribute_002" context="topicref">
<sch:report xmlns:sqf="http://www.schematron-quickfix.com/validator/process"
test="attribute::type = 'concept' or attribute::type = 'task' or attribute::type = 'reference'"
sqf:fix="removeType" role="warning"
>attribute_002: This is unnecessary. The DITA Open Toolkit can automatically identify the information type.</sch:report>
<sqf:fix xmlns:sqf="http://www.schematron-quickfix.com/validator/process"
id="removeType">
<sqf:description>
<sqf:title>Remove the @type attribute?</sqf:title>
</sqf:description>
<sqf:delete match="@type"/>
</sqf:fix>
</sch:rule>
This rule does not work. It will always throw a warning on any <keydef> element, even when the element does not have the @processing-role attribute specified.
Code: Select all
<sch:rule id="attribute_001" context="keydef">
<sch:report xmlns:sqf="http://www.schematron-quickfix.com/validator/process"
test="attribute::processing-role ='resource-only'" sqf:fix="removeprocessing-role"
role="warning"
see="https://www.oasis-open.org/committees/download.php/40946/understanding-dita-keys-and-key-spaces.pdf"
>attribute_001: @processing-role = "resource-only" is the default processing for key
definitions. </sch:report>
<sqf:fix xmlns:sqf="http://www.schematron-quickfix.com/validator/process"
id="removeprocessing-role">
<sqf:description>
<sqf:title>Remove the @processing-role attribute?</sqf:title>
</sqf:description>
<sqf:delete match="@processing-role"/>
</sqf:fix>
</sch:rule>
Suggestions?
Also, we notice that sometimes the schematron rules only work when we add the processing instruction to associate the schema on the specific file, like this:
Code: Select all
<?xml-model href="../../../../documentation/documents/schematron_rules.sch" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?>
Thanks for your help.
Take care,
- Nick