Creating a custom action on an extended framework using XSLT Operation
Post here questions and problems related to oXygen frameworks/document types.
-
jeffsese
- Posts: 1
- Joined: Sat Jun 20, 2026 12:33 pm
Creating a custom action on an extended framework using XSLT Operation
Hello forum,
I've been digging around in creating custom actions to help XML markup editors speed up their work and at the same time eliminating use of MS Word to do partial tagging (by using macros) and instead allow them to straight up use Oxygen instead. I have managed to use the batch converter to convert Word files to XHTML then created a custom XSLT to partially convert the XHTML to the markup specs they needed . However there are some inline markup that I cannot straight up convert from XHTML.
My plan now is to use custom actions to replace the inline markup by highlighting them in Author view and triggering the operation ro.sync.ecss.extensions.commons.operations.XSLTOperation however I'm not having any success in my attempts. Here is the screenshot of the action panel.
My issue right now is that the XSLT is replacing all from the document instead of just those that in the highlighted node in Author. How can I limit the action to just the highlighted content (I'm making sure the the highlighted content is a valid XML so that it can be processed as a single XML document node).
Also is it possible to set in Author that I can prompt the user to choose which XSLT operation to apply because the highlighted content might match multiple scenarios based on the context of the string being processed.
Looking forward to some insights on how to move forward with this issue.
Thanks!
I've been digging around in creating custom actions to help XML markup editors speed up their work and at the same time eliminating use of MS Word to do partial tagging (by using macros) and instead allow them to straight up use Oxygen instead. I have managed to use the batch converter to convert Word files to XHTML then created a custom XSLT to partially convert the XHTML to the markup specs they needed . However there are some inline markup that I cannot straight up convert from XHTML.
My plan now is to use custom actions to replace the inline markup by highlighting them in Author view and triggering the operation ro.sync.ecss.extensions.commons.operations.XSLTOperation however I'm not having any success in my attempts. Here is the screenshot of the action panel.
image.png
And here is my XSLT:
Code: Select all
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:math="http://www.w3.org/2005/xpath-functions/math"
xmlns:oxy="http://www.oxygenxml.com/ns/author/xpath-extension-functions"
exclude-result-prefixes="xs math oxy"
version="3.0">
<xsl:template match="/">
<xsl:message select="oxy:current-element()"/>
<xsl:apply-templates select="oxy:current-element()"/>
</xsl:template>
<xsl:template match="citation/emphasis">
<citetitle><xsl:apply-templates/></citetitle>
</xsl:template>
<xsl:template match="node() | @*">
<xsl:copy>
<xsl:apply-templates select="node() | @*"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>Also is it possible to set in Author that I can prompt the user to choose which XSLT operation to apply because the highlighted content might match multiple scenarios based on the context of the string being processed.
Looking forward to some insights on how to move forward with this issue.
Thanks!
You do not have the required permissions to view the files attached to this post.
-
Radu
- Posts: 9683
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Creating a custom action on an extended framework using XSLT Operation
Hi,
Interesting project!
Please see some answers below:
So the "sourceLocation" param is not set to anything, which means the element at the caret position. But when you select an entire element, the caret position is actually outside of the element. So this is why I think you have the problem, you select an element in the Author mode, click the action, and the XSLT is applied on its parent element instead.
Maybe you can set the "sourceLocation" param to have the XPath value "oxy:current-selected-element()" or a combination of "oxy:current-selected-element() | .":
https://www.oxygenxml.com/doc/versions/ ... ement.html
Interesting project!
Please see some answers below:
Your sample looks similar to the one from our docs: https://www.oxygenxml.com/doc/versions/ ... yoperationMy issue right now is that the XSLT is replacing all from the document instead of just those that in the highlighted node in Author. How can I limit the action to just the highlighted content (I'm making sure the the highlighted content is a valid XML so that it can be processed as a single XML document node)
So the "sourceLocation" param is not set to anything, which means the element at the caret position. But when you select an entire element, the caret position is actually outside of the element. So this is why I think you have the problem, you select an element in the Author mode, click the action, and the XSLT is applied on its parent element instead.
Maybe you can set the "sourceLocation" param to have the XPath value "oxy:current-selected-element()" or a combination of "oxy:current-selected-element() | .":
https://www.oxygenxml.com/doc/versions/ ... ement.html
Well you can create multiple Author actions, each with its own XSLT operation and the user can pick the proper Author action from the toolbar.Also is it possible to set in Author that I can prompt the user to choose which XSLT operation to apply because the highlighted content might match multiple scenarios based on the context of the string being processed.
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)
- ↳ 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