Customizing Smart Paste Support

The Smart Paste feature preserves certain style and structure information when copying content from some of the most common applications and pasting into document types that support Smart Paste in Oxygen XML Editor. For other document types, the default behavior of the paste operation is to keep only the text content without the styling.

The style of the pasted content can be customized by editing an XSLT stylesheet for the particular document type. The XSLT stylesheet must accept an XHTML flavor of the copied content as input, and transform it to the equivalent XML markup that is appropriate for the target document type of the paste operation.

A default XSLT stylesheet that can be edited to customize the mapping between the markup of the copied content and the markup of the pasted content is included the following directory for each supported document type: [OXYGEN INSTALLATION DIRECTORY]/frameworks/[Document Type]/resources. The name of this default XSLT file begins with xhtml2, followed by the document type (for example, xhtml2dita.xsl for the DITA document type).

The Default Stylesheet for DITA Document Type

To customize the mapping for a DITA topic, edit the [OXYGEN INSTALLATION DIRECTORY]/frameworks/dita/resources/xhtml2dita.xsl stylesheet. To test the modifications done in the stylesheet, you can start pasting content without having to restart Oxygen XML Editor.

Note: Oxygen XML Editor implements the Smart Paste feature by setting up a stylesheet which is obtained by Oxygen XML Editor from the getImporterStylesheetFileName method. This method is available in an instance of the AuthorExternalObjectInsertionHandler class, which is returned by the createExternalObjectInsertionHandler method of the ExtensionsBundle instance of the target document type.
Related information
Smart Paste Support