SQF for keydef + topicref attributes
This should cover W3C XML Schema, Relax NG and DTD related problems.
-
- Posts: 86
- Joined: Sun May 03, 2015 7:34 pm
- Location: San Francisco
SQF for keydef + topicref attributes
Post by urbanrobots »
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
-
- Posts: 388
- Joined: Thu Jul 01, 2004 12:29 pm
Re: SQF for keydef + topicref attributes
Hello Nick,
The assert for the "keydef/@processing-role" attribute does not work because the default value for the "processing-role" attribute is "resource-only". When the XML is validated against Schematron you cannot determine if the attribute is set in document or is just the default value from the schema. This is why after the attribute is removed from document the assert still fails because it gets the default attribute value from the schema.
There is a discussion on our forum related with this, but we do not have a solution yet:
topic11639.html
We have an issue on our issue tracker. I added your comment there and we will notify you when this issue will be solved.
Best Regards,
Octavian
The assert for the "keydef/@processing-role" attribute does not work because the default value for the "processing-role" attribute is "resource-only". When the XML is validated against Schematron you cannot determine if the attribute is set in document or is just the default value from the schema. This is why after the attribute is removed from document the assert still fails because it gets the default attribute value from the schema.
There is a discussion on our forum related with this, but we do not have a solution yet:
topic11639.html
We have an issue on our issue tracker. I added your comment there and we will notify you when this issue will be solved.
Best Regards,
Octavian
Octavian Nadolu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 86
- Joined: Sun May 03, 2015 7:34 pm
- Location: San Francisco
Re: SQF for keydef + topicref attributes
Post by urbanrobots »
Okay. Thanks, Octavian.
Take care,
- Nick
Take care,
- Nick
-
- Posts: 9431
- Joined: Fri Jul 09, 2004 5:18 pm
Re: SQF for keydef + topicref attributes
Hi,
Starting with Oxygen 19.1, by default Schematron applied on XML Schema based XML documents will also take into account default attributes so this should be useful when adding rules for DITA-based validation.
Regards,
Radu
Starting with Oxygen 19.1, by default Schematron applied on XML Schema based XML documents will also take into account default attributes so this should be useful when adding rules for DITA-based validation.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service