History | Edit

Question

How can I change the way a DocBook 4 xref displays in Author mode based on what element is at the linkend?

Answer

Follow these steps:
  1. Create a Maven Java project and add a dependency on the Oxygen XML Editor classes:
    <dependency>
        <groupId>com.oxygenxml</groupId>
        <artifactId>oxygen-sdk</artifactId>
        <version>${oxygen.version}</version>
    </dependency>
    where ${oxygen.version} is the version of Oxygen XML Editor.

    Alternatively, if the project does not use Maven, all the transitive dependencies of the above Maven artifact need to be added to the classpath of the project.

  2. Also add the [OXYGEN_INSTALL_DIR]\frameworks\docbook\docbook.jar to the class path of the project.
  3. Create a class that extends ro.sync.ecss.extensions.docbook.DocBook4ExtensionsBundle and overwrites the method: ro.sync.ecss.extensions.api.ExtensionsBundle#createLinkTextResolver()
  4. For your custom resolver implementation you can start from the Java sources of the ro.sync.ecss.extensions.docbook.link.DocbookLinkTextResolver (the Java code for the entire DocBook customization is present in a subfolder in the Oxygen SDK).
  5. Pack your extension classes in a JAR file. Copy the JAR to: [OXYGEN_INSTALL_DIR]\frameworks\docbook\custom.jar.
  6. Start Oxygen XML Editor.
  7. Open the Preferences dialog box (Options > Preferences) and go to Document Type Association. Edit the DocBook 4 document type. In the Classpath list add the path to the new JAR. In the extensions list select your custom extension instead of the regular DocBook one.
  8. You can rename the document type and the docbook framework folder to something else (such as custom_docbook) and share it with others. A document type can also be installed using our add-on support.