Comparing multiple strings in Schematron
Posted: Wed Nov 25, 2020 2:21 am
I've got the following source:
I need to create a Schematron to compare these values and report any different links.
I've got:
But I'm getting an error:
Any ideas how to properly compare these strings in Schematron?
Code: Select all
<dt><xref
href="https://staging.example.com/example.html"
format="html" scope="external" product="staging">My link
text</xref><xref
href="https://production.example.com/example.html"
format="html" scope="external" product="production">My link
text</xref><xref
href="../example.xml"
format="html" scope="external" product="local">Different link
text</xref></dt>
I've got:
Code: Select all
<sch:pattern>
<sch:rule context="*[count(xref = 3)]">
<sch:let name="stag"><xsl:value-of select="normalize-space(xs:string(xref[@product='staging]))"/></sch:let>
<sch:let name="prod"><xsl:value-of select="normalize-space(xs:string(xref[@product='production']))"/></sch:let>
<sch:let name="local"><xsl:value-of select="normalize-space(xs:string(xref[@product='local']))"/></sch:let>
<sch:assert id="myRule"
test="($stag = $prod) and ($stag = $local)"
role="error"
sqf:fix="addPeriod">myRule: The text of this group of links must all match.</sch:assert>
</sch:rule>
</sch:pattern>
As you can see, I tried to normalize spaces and ensure that they are strings.Engine name: ISO Schematron
Severity: warning
Description: Cannot convert string "My link\n..." to double
Start location: 889:41
Any ideas how to properly compare these strings in Schematron?