Schematron: catch inconsistent spelling
Oxygen general issues.
-
- Posts: 156
- Joined: Sat Feb 26, 2005 12:09 am
- Location: USA
- Contact:
Schematron: catch inconsistent spelling
Post by shudson310 »
One of the features in Vale is that it can catch inconsistent use of a particular spelling. For example, "cancelled" and "canceled" can both be accepted forms of the word. I want to write a Schematron rule that flags a document that uses both forms of the word! You can use one or the other forms, but not both.
What would you suggest for such a rule?
What would you suggest for such a rule?
Scott Hudson
Staff Content Engineer
Site: docs.servicenow.com
Staff Content Engineer
Site: docs.servicenow.com
-
- Posts: 388
- Joined: Thu Jul 01, 2004 12:29 pm
Re: Schematron: catch inconsistent spelling
Hello Scott,
One solution is to check if both words are used in the document and highlight one of the words. You can also propose a quick fix that will replace all occurrences of an word with another, something like this:
Best Regards,
Octavian
One solution is to check if both words are used in the document and highlight one of the words. You can also propose a quick fix that will replace all occurrences of an word with another, something like this:
Code: Select all
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2"
xmlns:sqf="http://www.schematron-quickfix.com/validator/process">
<sch:let name="firstCancelled" value="(//text()[contains(., 'cancelled')])[1]"/>
<sch:pattern>
<sch:rule context="text()[contains(., 'canceled')]">
<sch:report test="$firstCancelled" sqf:fix="replaceWithCancelled replaceWithCanceled"> Both 'cancelled' and
'canceled' are used. </sch:report>
<sqf:fix id="replaceWithCancelled">
<sqf:description>
<sqf:title>Replace all 'canceled' occurances with 'cancelled'</sqf:title>
</sqf:description>
<sqf:stringReplace match="//text()[contains(., 'canceled')]" regex="canceled" select="'cancelled'"/>
</sqf:fix>
<sqf:fix id="replaceWithCanceled">
<sqf:description>
<sqf:title>Replace all 'cancelled' occurances with 'canceled'</sqf:title>
</sqf:description>
<sqf:stringReplace match="//text()[contains(., 'cancelled')]" regex="cancelled" select="'canceled'"/>
</sqf:fix>
</sch:rule>
</sch:pattern>
</sch:schema>
Octavian
Octavian Nadolu
<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