Wrapping text() with a Quick Fix not working as expected. Why?
Post here questions and problems related to editing and publishing DITA content.
-
- Posts: 31
- Joined: Sat Jan 17, 2015 6:21 pm
Wrapping text() with a Quick Fix not working as expected. Why?
Hi,
The following Quick Fix does wrap the text() in a paragraph but puts it as a next sibling to the section.
How could I fix this? I've tried many variations all afternoon but nothing worked! Using Oxygen 18.
TIA,
Raymond
The following Quick Fix does wrap the text() in a paragraph but puts it as a next sibling to the section.
How could I fix this? I've tried many variations all afternoon but nothing worked! Using Oxygen 18.
Code: Select all
<rule context="*[contains(@class, ' topic/section ')]/text()[string-length(normalize-space(.)) > 0]">
<report test="true()" role="warn" subject="child::node()[1]" sqf:fix="wrapInParagraph">
The text in a section element should be in a paragraph.</report>
<!-- Wrap the current element in a paragraph. -->
<sqf:fix id="wrapInParagraph">
<sqf:description>
<sqf:title>Wrap text in a paragraph</sqf:title>
</sqf:description>
<sqf:replace node-type="element" target="p">
<xsl:apply-templates mode="copyExceptClass" select="."/>
</sqf:replace>
<sqf:delete/>
</sqf:fix>
</rule>
Raymond
-
- Posts: 388
- Joined: Thu Jul 01, 2004 12:29 pm
Re: Wrapping text() with a Quick Fix not working as expected. Why?
Hello,
Thank you for the feedback.
It seems that we do not compute the context node correctly in this case. The context node for the insert element operation should be the text node and the quick fix must insert the element after the text node, not after the section. I added an issue on out issue tracker to analyze this situation.
As an workaround you can replace the text node with a fragment that contains the text. The Schematron can be something like this:
Best Regards,
Octavian
Thank you for the feedback.
It seems that we do not compute the context node correctly in this case. The context node for the insert element operation should be the text node and the quick fix must insert the element after the text node, not after the section. I added an issue on out issue tracker to analyze this situation.
As an workaround you can replace the text node with a fragment that contains the text. The Schematron can be something like this:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2"
xmlns:sqf="http://www.schematron-quickfix.com/validator/process" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<sch:pattern>
<sch:rule context="*[contains(@class, ' topic/section ')]/text()[string-length(normalize-space(.)) > 0]">
<sch:report test="true()" role="warn" subject="child::node()[1]" sqf:fix="wrapInParagraph">
The text '<sch:value-of select="."/>' from section element should be in a paragraph.</sch:report>
<!-- Wrap the current element in a paragraph. -->
<sqf:fix id="wrapInParagraph">
<sqf:description>
<sqf:title>Wrap text '<sch:value-of select="."/>' in a paragraph</sqf:title>
</sqf:description>
<sqf:replace>
<p>
<xsl:value-of select="."/>
</p>
</sqf:replace>
</sqf:fix>
</sch:rule>
</sch:pattern>
</sch:schema>
Best Regards,
Octavian
Octavian Nadolu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 388
- Joined: Thu Jul 01, 2004 12:29 pm
Re: Wrapping text() with a Quick Fix not working as expected. Why?
Hello Raymond,
We just released <oXygen/> XML Editor version 20. Please note that the issue that you reported regarding the sqf:replace operation was solved.
You can download the build from here:
https://www.oxygenxml.com/xml_editor/do ... ditor.html
Thanks again for your feedback.
Best Regards,
Octavian
We just released <oXygen/> XML Editor version 20. Please note that the issue that you reported regarding the sqf:replace operation was solved.
You can download the build from here:
https://www.oxygenxml.com/xml_editor/do ... ditor.html
Thanks again for your feedback.
Best Regards,
Octavian
Octavian Nadolu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Return to “DITA (Editing and Publishing DITA Content)”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ 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