Example: Configure Content Completion to Insert a Certain XML StructureEdit online
It is possible to configure the Content Completion Assistant to insert a certain
XML structure instead of an element. For example, suppose that whenever a DITA
<change-completed>
element is inserted with the Content
Completion Assistant, you want the current date to be inserted as the text content of
the <change-completed>
element.
This can be achieved by defining a custom Author mode action in
your custom framework:
- In Oxygen XML Editor/Author, go to and edit the document type configuration for your framework.
- Go to the Author tab, then the Actions
subtab, and click the
New button.
- Define the custom action and include the following details:
- In the Activation XPath field, enter
oxy:allows-child-element("change-completed")
. For information about theoxy:allows-child-element
function, see: https://www.oxygenxml.com/doc/ug-editor/topics/oxy-allows-child-element.html. - For Operation, choose
ro.sync.ecss.extensions.commons.operations.InsertFragmentOperation
. For information about theInsertFragmentOperation
, see https://www.oxygenxml.com/doc/ug-editor/topics/dg-author-op-InsertFragmentOperation-arguments.html. - In the Arguments table, double-click
fragment and for its value, enter
<change-completed>${date('YYYY-MM-DD')}</change-completed>
.
- In the Activation XPath field, enter
- Go to the Content Completion subtab and add the action to the content completion
menu.Note: If the action implemented in JavaScript, you will need to also create a dummy action with the same ID in the framework and insert it in the content completion menu. The dummy action should have an operation but is not important which one.
- Remove the
<change-completed>
element from the content completion list. You can do this by editing the cc_config.xml configuration file for your custom framework and use therejectElements
element to filter out the<change-completed>
element. For information, see Configuring the Proposals for Elements and Attributes. - Save the changes to your custom framework.
- Create an archive that only contains your custom framework folder and upload your framework to Web Author.
Tip: Another possibility to achieve this specific example is to use a custom form control when the
<change-completed>
element is empty.