Sub-topic Linking Using PrinceXML

Posts: 4

Sub-topic Linking Using PrinceXML

Thu Nov 10, 2016 1:35 am

We are trying to create a DITA style sheet based on your DItamap - WYSIWYG - Experimental transformation, and seem to be just about there. However, links that refer to subtopic elements (i.e., links that contain the "#" character), although they appear underlined as links, are not active. I have tried various combinations of attributes, starting with what oXygen gives me if I use the xref (cross-reference) dialog from the element pop-up (which is "no attributes").
For instance, the following works:
[Codebox=]<xref href="concept_profiling_instrumenting_code_measure_performance.dita>This is a test</xref>[/Codebox]
But the following (which was inserted using oXygen) does not.
[Codebox=]<xref href="concept_profiling_instrumenting_code_measure_performance.dita#concept_profiling_instrumenting_code_measure_performance/ol_kgw_wxf_js>This is a test</xref>[/Codebox]
The links with "#" work in our HTML output. Just not in our PDF output using PrinceXML. I have made a lot of styling changes to the CSS, but even when I reset everything to the original that shipped with 18.1 and run the transform, the same links are broken. Any ideas what I am doing wrong?
Posts: 189

Re: Sub-topic Linking Using PrinceXML

Thu Nov 10, 2016 1:28 pm


Thank you for reporting this problem. We will include a fix in the next release.

Meanwhile, follow these steps to activate the links:
  • open the following file (you must have admin role to do it):


    and add the following line after the last xsl:include:

    Code: Select all

    <xsl:include href="post-process-links.xsl"/>
  • In the same folder, create the file post-process-links.xsl, with the following content:

    Code: Select all

    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet xmlns:xsl=""
            The merged DITA map file may contain cross references to elements from a topic. In this case, the reference looks like:

            <xref class="- topic/xref "

            Where the "ohref" is the original value from the DITA source, and the "href" is generated by the merging process.
            The value of the href cannot be used by the XML+CSS to PDF processor, because it is not a valid IDREF (contains a / )
            so wee need to remove the part before the slash.
        <xsl:template match="@href[starts-with( ., '#') and contains(., '/')]">
            <xsl:attribute name="href" select="concat('#',substring-after(., '/'))"/>

After these changes the links should be active in the output.

Best Regards,
Mihaela Calotescu
Posts: 4

Re: Sub-topic Linking Using PrinceXML

Thu Nov 10, 2016 9:35 pm

Thank you. This works great!

Return to “DITA (Editing and Publishing DITA Content)”

Who is online

Users browsing this forum: No registered users and 0 guests