schematron replace-curly-doublequotes
Posted: Tue Sep 01, 2020 3:27 pm
Hello team , we have implemented a schematron rule for replacing curly double quotes.
<sch:pattern id="isTopicContainsCurlyDoubleQuotes">
<sch:rule context="/*[contains(@class, ' topic/topic ')]">
<sch:let name="text" value="normalize-space(.)"/>
<sch:report test=".//text()[contains(., '“')]" role="error" sqf:fix="replace-curly-doublequotes">Replace curly double
quotes ” with <q> your text goes here </q> . </sch:report>
<sqf:fix id="replace-curly-doublequotes">
<sqf:description>
<sqf:title>Replace curly double quotes</sqf:title>
</sqf:description>
<!-- <sqf:stringReplace match="//text()[contains(., '”')]" regex="”" select="</q>"/>
<sqf:stringReplace match="//text()[contains(., '“')]" regex="“" select="<q>"/> -->
<sqf:stringReplace match="//text()[contains(., '”')]" regex="”" select=" '</q>' "/>
<sqf:stringReplace match="//text()[contains(., '“')]" regex="“" select=" '<q>' "/>
</sqf:fix>
</sch:rule>
</sch:pattern>
the <sqf:fix> for example it replaces
“test1 test2 - Success” to <q>test1 test2 - Success</q>
in author mode it's treating like a normal text only <q>test1 test2 - Success</q> would you pleas help me here?
<sch:pattern id="isTopicContainsCurlyDoubleQuotes">
<sch:rule context="/*[contains(@class, ' topic/topic ')]">
<sch:let name="text" value="normalize-space(.)"/>
<sch:report test=".//text()[contains(., '“')]" role="error" sqf:fix="replace-curly-doublequotes">Replace curly double
quotes ” with <q> your text goes here </q> . </sch:report>
<sqf:fix id="replace-curly-doublequotes">
<sqf:description>
<sqf:title>Replace curly double quotes</sqf:title>
</sqf:description>
<!-- <sqf:stringReplace match="//text()[contains(., '”')]" regex="”" select="</q>"/>
<sqf:stringReplace match="//text()[contains(., '“')]" regex="“" select="<q>"/> -->
<sqf:stringReplace match="//text()[contains(., '”')]" regex="”" select=" '</q>' "/>
<sqf:stringReplace match="//text()[contains(., '“')]" regex="“" select=" '<q>' "/>
</sqf:fix>
</sch:rule>
</sch:pattern>
the <sqf:fix> for example it replaces
“test1 test2 - Success” to <q>test1 test2 - Success</q>
in author mode it's treating like a normal text only <q>test1 test2 - Success</q> would you pleas help me here?