Trigger DeleteElementsOperation when a document is opened
Post here questions and problems related to editing and publishing DITA content.
-
- Posts: 41
- Joined: Thu Jun 02, 2022 1:39 pm
Trigger DeleteElementsOperation when a document is opened
Post by antonyterrence »
Is it possible to trigger the DeleteElementsOperation author action automatically, say, when a document is opened in the web author?
-
- Posts: 496
- Joined: Thu Sep 04, 2014 4:22 pm
Re: Trigger DeleteElementsOperation when a document is opened
Post by cristi_talau »
Hello,
Triggering actions when a document loads is technically possible using the JS API. You can find more details in this tutorial [1] where you have both the event when the document loads and the code to invoke an operation.
However, modifying the document when it is opened may not be the best UX for an integration. Users may find it confusing that the document is opened directly in a modified state. Depedning on what you are trying to achieve there might be a better solution. If you can give us more details, we may be able to advise you towards a solution.
Best,
Cristian
[1] https://www.oxygenxml.com/maven/com/oxy ... fydoc.html
Triggering actions when a document loads is technically possible using the JS API. You can find more details in this tutorial [1] where you have both the event when the document loads and the code to invoke an operation.
However, modifying the document when it is opened may not be the best UX for an integration. Users may find it confusing that the document is opened directly in a modified state. Depedning on what you are trying to achieve there might be a better solution. If you can give us more details, we may be able to advise you towards a solution.
Best,
Cristian
[1] https://www.oxygenxml.com/maven/com/oxy ... fydoc.html
-
- Posts: 41
- Joined: Thu Jun 02, 2022 1:39 pm
Re: Trigger DeleteElementsOperation when a document is opened
Post by antonyterrence »
Here is what I am trying to achieve:
If <critdates> contains more than 3 <revised> elements, the custom Action should delete the all revised elements except the last three.
I have created an custom action using DeleteElementsOperation. However, writers have to perform the operation manually. I am trying to avoid the manual effort on the part of writers. Instead, automatically execute the action if the current document has more than 3 <revised> elements.
Tool: Oxygen XML Web Author
If <critdates> contains more than 3 <revised> elements, the custom Action should delete the all revised elements except the last three.
I have created an custom action using DeleteElementsOperation. However, writers have to perform the operation manually. I am trying to avoid the manual effort on the part of writers. Instead, automatically execute the action if the current document has more than 3 <revised> elements.
Tool: Oxygen XML Web Author
-
- Posts: 496
- Joined: Thu Sep 04, 2014 4:22 pm
Re: Trigger DeleteElementsOperation when a document is opened
Post by cristi_talau »
Hello,
One option to implement this would be to delete the old revised elements when new ones are inserted. There are several approaches here:
Cristian
One option to implement this would be to delete the old revised elements when new ones are inserted. There are several approaches here:
- Implement a Schematron validation rule with a Quick fix. The quick fix allows users to delete the old revised elements with a single click,
- Display a form control button "Delete old revisions" on the last revised element when there are more than 3 elements.
Cristian
-
- Posts: 41
- Joined: Thu Jun 02, 2022 1:39 pm
Re: Trigger DeleteElementsOperation when a document is opened
Post by antonyterrence »
We have explored both possibilities. The problem with both approach is that writers have to perform the action by clicking a button or applying a quick fix. Can the quick fix or custom action be triggered when the current document changes or edited? We want to automate the action.
-
- Posts: 496
- Joined: Thu Sep 04, 2014 4:22 pm
Re: Trigger DeleteElementsOperation when a document is opened
Post by cristi_talau »
Hello,
Another idea would be set up an AuthorDocumentFilter that detects that multiple critdates were inserted and deletes the old ones.
Best,
Cristian
Another idea would be set up an AuthorDocumentFilter that detects that multiple critdates were inserted and deletes the old ones.
Best,
Cristian
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