Page 1 of 1

schematron replace-curly-doublequotes

Posted: Tue Sep 01, 2020 3:27 pm
by vishwavaranasi
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(., '&#x201C;')]" role="error" sqf:fix="replace-curly-doublequotes">Replace curly double
quotes ” with &lt;q&gt; your text goes here &lt;/q&gt; . </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(., '&#x201D;')]" regex="&#x201D;" select="</q>"/>
<sqf:stringReplace match="//text()[contains(., '&#x201C;')]" regex="&#x201C;" select="<q>"/> -->
<sqf:stringReplace match="//text()[contains(., '&#x201D;')]" regex="&#x201D;" select=" '&lt;/q&gt;' "/>
<sqf:stringReplace match="//text()[contains(., '&#x201C;')]" regex="&#x201C;" select=" '&lt;q&gt;' "/>
</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>
image.png
would you pleas help me here?

Re: schematron replace-curly-doublequotes

Posted: Wed Sep 02, 2020 4:44 pm
by tavy
Hello,

In Author mode we automatically render "&lt;" with "<", and "&gt;" with ">". But if you switch to Text page you will notice that is correct, based on your replace.
How do you want the result to bein text, like this " &lt;q&gt;test1 test2 - Success&lt;/q&gt;" or like this " <q>test1 test2 - Success</q>"?

Best Regards,
Octavian