Quick fix fails silently
Having trouble installing Oxygen? Got a bug to report? Post it all here.
-
- Posts: 15
- Joined: Mon Jun 19, 2017 11:24 pm
Quick fix fails silently
I have a schematron rule that checks for the substring 911 in various contexts. I want to replace the string with an empty element that will be used to automatically generate the emergency number for each locale. The initial test works, but the quick fix does not. I get no error, but nothing happens.
<rule context="title | navtitle | p | dt | dd | li | cmd" role="info">
<report test="contains(., '911')" role="warn" sqf:fix="replace911text">All 911 text should be replaced with emnumber.</report>
<sqf:fix id="replace911text">
<sqf:description>
<sqf:title>Replace text 911 with the emnumber tag.</sqf:title>
</sqf:description>
<sqf:stringReplace regex="911">
<emnumber/>
</sqf:stringReplace>
</sqf:fix>
</rule>
My fix is almost identical to one shown at https://td-demo.titaniasoftware.com/por ... operations, which I assume works.
Any suggestions?
Thanks,
Bill
<rule context="title | navtitle | p | dt | dd | li | cmd" role="info">
<report test="contains(., '911')" role="warn" sqf:fix="replace911text">All 911 text should be replaced with emnumber.</report>
<sqf:fix id="replace911text">
<sqf:description>
<sqf:title>Replace text 911 with the emnumber tag.</sqf:title>
</sqf:description>
<sqf:stringReplace regex="911">
<emnumber/>
</sqf:stringReplace>
</sqf:fix>
</rule>
My fix is almost identical to one shown at https://td-demo.titaniasoftware.com/por ... operations, which I assume works.
Any suggestions?
Thanks,
Bill
Bill Burns
Content Architect | Healthwise
bburns@healthwise.org | www.healthwise.org
208.331.6917 (office) | 208.345.1897 (fax)
Healthwise helps people make better health decisions.
Content Architect | Healthwise
bburns@healthwise.org | www.healthwise.org
208.331.6917 (office) | 208.345.1897 (fax)
Healthwise helps people make better health decisions.
-
- Posts: 389
- Joined: Thu Jul 01, 2004 12:29 pm
Re: Quick fix fails silently
Hi Bill,
The sqf:stringReplace operation applies only on text nodes. The context of your rule are element nodes (title | navtitle | p | dt | dd | li | cmd), and this is why the quick fix does not work. Therefore, you need to specify that the quick fix will match the text from the current element using match="text()". Also I recommend to use a prefix for the Schematron elements otherwise the <emnumber/> element will be considered to be in the Schematron namespace, and you want to be in no namespace. The Schematron should look something like this:
Probably we should show an error in case the quick fix does not work, and explain what happen. I will add an issue on our internal issue tracker for this. Thanks for your feedback.
You can read more about the SQF stringReplace operation in our User manual:
https://www.oxygenxml.com/doc/versions/ ... ng-replace
Best Regards,
Octavian
The sqf:stringReplace operation applies only on text nodes. The context of your rule are element nodes (title | navtitle | p | dt | dd | li | cmd), and this is why the quick fix does not work. Therefore, you need to specify that the quick fix will match the text from the current element using match="text()". Also I recommend to use a prefix for the Schematron elements otherwise the <emnumber/> element will be considered to be in the Schematron namespace, and you want to be in no namespace. The Schematron should look something like this:
Code: Select all
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2"
xmlns:sqf="http://www.schematron-quickfix.com/validator/process">
<sch:pattern>
<sch:rule context="title | navtitle | p | dt | dd | li | cmd" role="info">
<sch:report test="contains(., '911')" role="warn" sqf:fix="replace911text">All 911 text should be replaced with emnumber.</sch:report>
<sqf:fix id="replace911text">
<sqf:description>
<sqf:title>Replace text 911 with the emnumber tag.</sqf:title>
</sqf:description>
<sqf:stringReplace match="text()" regex="911">
<emnumber/>
</sqf:stringReplace>
</sqf:fix>
</sch:rule>
</sch:pattern>
</sch:schema>
You can read more about the SQF stringReplace operation in our User manual:
https://www.oxygenxml.com/doc/versions/ ... ng-replace
Best Regards,
Octavian
Octavian Nadolu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 15
- Joined: Mon Jun 19, 2017 11:24 pm
Re: Quick fix fails silently
Thanks, Octavian. That worked. Still finding my way around some of the functions. I tried using matches() in the report node test as in the example, and that didn't work, so I didn't think to use it once I'd matched the substring.
Bill Burns
Content Architect | Healthwise
bburns@healthwise.org | www.healthwise.org
208.331.6917 (office) | 208.345.1897 (fax)
Healthwise helps people make better health decisions.
Content Architect | Healthwise
bburns@healthwise.org | www.healthwise.org
208.331.6917 (office) | 208.345.1897 (fax)
Healthwise helps people make better health decisions.
-
- Posts: 15
- Joined: Mon Jun 19, 2017 11:24 pm
Re: Quick fix fails silently
Incidently, can these quick fixes be run automatically outside of the Oxygen environment? I haven't seen their use anywhere else.
Bill Burns
Content Architect | Healthwise
bburns@healthwise.org | www.healthwise.org
208.331.6917 (office) | 208.345.1897 (fax)
Healthwise helps people make better health decisions.
Content Architect | Healthwise
bburns@healthwise.org | www.healthwise.org
208.331.6917 (office) | 208.345.1897 (fax)
Healthwise helps people make better health decisions.
-
- Posts: 389
- Joined: Thu Jul 01, 2004 12:29 pm
Re: Quick fix fails silently
Hi Bill,
The quick fixes can be run only inside Oxygen, we so not have support to run them outside.
You can try to use Escali engine, that also supports Schematron Quick Fixes:
https://github.com/schematron-quickfix/escali-package
Best Regards,
Octavian
The quick fixes can be run only inside Oxygen, we so not have support to run them outside.
You can try to use Escali engine, that also supports Schematron Quick Fixes:
https://github.com/schematron-quickfix/escali-package
Best Regards,
Octavian
Octavian Nadolu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ Artificial Intelligence (AI Positron Assistant add-on)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service