Turn Off Tracked Changes for All Topics Via XSLT Custom Refactoring
Post here questions and problems related to oXygen frameworks/document types.
-
- Posts: 147
- Joined: Thu Aug 30, 2018 10:06 pm
Turn Off Tracked Changes for All Topics Via XSLT Custom Refactoring
Post by dreifsnider »
Hi,
I'm trying to create a new custom refactoring operation that will add one additional step to the out-of-the-box refactoring operation "Accept all tracked changes, remove all comments and highlights".
The one additional step is to also turn off the tracked changes state in the file. I've tried to accomplish this via using the same Xpath syntax to select processing-instructions that exists in the out-of-the-box refactoring operation, for example:
However, this doesn't actually select the "oxy_options" processing-instruction. Indeed, even a blanket match="processing-instruction()" doesn't even select this processing-instruction. Is this processing-instruction removed from the DOM and is unselectable?
To test, I used Oxygen's XPath/XQuery Builder, and it selects this processing-instruction as expected:
For context, the reason why I'd also like to remove the track_changes processing-instruction on top of all the other review processing-instructions is because our translation teams report that Trados either has issues with this processing-instruction or that the presence of this processing-instruction adds additional noise to the topic.
Therefore, we'd like a single refactoring operation to remove all tracked changes, comments, and highlights, as well as turn off tracked changes in all topics across a DITA Map.
Thank you!
Daniel
I'm trying to create a new custom refactoring operation that will add one additional step to the out-of-the-box refactoring operation "Accept all tracked changes, remove all comments and highlights".
The one additional step is to also turn off the tracked changes state in the file. I've tried to accomplish this via using the same Xpath syntax to select processing-instructions that exists in the out-of-the-box refactoring operation, for example:
Code: Select all
<xsl:template match="processing-instruction()[starts-with(name(), 'oxy_options')][contains(., 'track_changes="on"')]"/>
To test, I used Oxygen's XPath/XQuery Builder, and it selects this processing-instruction as expected:
- image.png (45.89 KiB) Viewed 884 times
Therefore, we'd like a single refactoring operation to remove all tracked changes, comments, and highlights, as well as turn off tracked changes in all topics across a DITA Map.
Thank you!
Daniel
Re: Turn Off Tracked Changes for All Topics Via XSLT Custom Refactoring
Hi Daniel,
The XML refactoring XSLT can use some special functions to manipulate the content before and after the root element as this content is not sent directly to the XSLT processor:
https://www.oxygenxml.com/doc/versions/ ... w_custom_r
Regards,
Radu
The XML refactoring XSLT can use some special functions to manipulate the content before and after the root element as this content is not sent directly to the XSLT processor:
https://www.oxygenxml.com/doc/versions/ ... w_custom_r
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 147
- Joined: Thu Aug 30, 2018 10:06 pm
Re: Turn Off Tracked Changes for All Topics Via XSLT Custom Refactoring
Post by dreifsnider »
Thanks Radu, I was able to use these functions to select the track_changes processing instruction and delete it.
Here's the XSLT that worked for me:
Daniel
Here's the XSLT that worked for me:
Code: Select all
<xsl:template match="/">
<xsl:variable name="content-after-root" as="xs:string" select="xrf:get-content-after-root()"/>
<xsl:variable name="content-except-track_change_toggle" as="xs:string">
<xsl:value-of select="replace($content-after-root, '<\?oxy_options track_changes="on"\?>', '' )"/>
</xsl:variable>
<xsl:value-of select="xrf:set-content-after-root($content-except-track_change_toggle)"/>
<xsl:apply-templates/>
</xsl:template>
Re: Turn Off Tracked Changes for All Topics Via XSLT Custom Refactoring
Hi Daniel,
Great, thanks for posting the solution!
I know it's a bit rough but for most devs making changes before and after the root element is not something usual.
Regards,
Radu
Great, thanks for posting the solution!
I know it's a bit rough but for most devs making changes before and after the root element is not something usual.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Return to “SDK-API, Frameworks - Document Types”
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