Sub-topic Linking Using PrinceXML

donlammers
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?
mihaela
Posts: 188

Re: Sub-topic Linking Using PrinceXML

Thu Nov 10, 2016 1:28 pm

Hi,

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):

    {OxygenInstallDir}/frameworks/dita/DITA-OT2.x/plugins/com.oxygenxml.pdf.css/xsl/post-process.xsl

    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="http://www.w3.org/1999/XSL/Transform"
        xmlns:xs="http://www.w3.org/2001/XMLSchema"
        exclude-result-prefixes="xs"
        version="2.0">
        <!--
            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 "
                href="#unique_3/unique_3_Connect_42_my_table_id"
                ohref="topics/care.dita#care/my_table_id"/>

            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(., '/'))"/>
        </xsl:template>

    </xsl:stylesheet>
After these changes the links should be active in the output.

Best Regards,
Mihaela
Mihaela Calotescu
http://www.oxygenxml.com
donlammers
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: Bing [Bot] and 0 guests