We have several common words or phrases we general wrap with <i> when they appear in text. I am trying to write a schematron rule to enforce this rule and suggest a quick fix to wrap the word or phrase in <i>. The following code works, but the warning underline underlines the beginning of the entire element surrounding the appearance of "Assay", and it necessitates writing an assertion for literally every word separately. Is there a way to generate the warning under "Assay" itself in a text() node?
More importantly, I would love any suggestions for a schematron quickfix that would wrap the offending word in an <i> and preserve the rest of the content in the tag.
Code: Select all
<rule context="*[not(ancestor-or-self::title) and not(ancestor-or-self::i)]/text()" role="warn">
<assert test="not(matches(., 'Assay'))">Assay is generally italicized when referenced in text</assert>