Test to see if text contains a string from a list of values
Posted: Fri Nov 06, 2020 5:05 am
I'm trying to create a Schematron rule that will check text nodes against a list of terms in an external document. Basically, I'm trying to see if writers included a product name directly in text instead of using a keyref in DITA.
I'm reading in my external document by:
I need a test that will check to see if the text nodes contain one of the values from
I can get an exact match using:
But that only works if the entire node matches. I want to check if the phrase is contained within a larger set of text.
Trying something like this: results in:
A sequence of more than one item is not allowed as the first argument of fn:contains() ("
", "
")
Any ideas?
I'm reading in my external document by:
Code: Select all
<sch:let name="keys"
value="document('keys-common.ditamap')"/>
Code: Select all
$keys//keyword
Code: Select all
<sch:let name="text" value="text()"/>
<sch:report id="now001"
test="$keys//keyword[normalize-space(.) =$text]"
role="error">
Trying something like this:
Code: Select all
test="$keys//keyword[contains($text, .)]"
A sequence of more than one item is not allowed as the first argument of fn:contains() ("
", "
")
Any ideas?