schematron replace-curly-doublequotes

Questions about XML that are not covered by the other forums should go here.
vishwavaranasi
Posts: 144
Joined: Fri Feb 28, 2020 4:02 pm

schematron replace-curly-doublequotes

Post 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
image.png (3.31 KiB) Viewed 1150 times
would you pleas help me here?
Thanks,
vishwa
tavy
Posts: 365
Joined: Thu Jul 01, 2004 12:29 pm

Re: schematron replace-curly-doublequotes

Post 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
Octavian Nadolu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply