Expand my Community achievements bar.

SOLVED

References to word or pdf documents in DITA causes broken link

Avatar

Level 3

I am using on premise AEM service pack 12 with FMDITA 4.1.

I am trying to add word and pdf documents as attachments to dita xml using cross reference. But after generating AEM SITE from dita , the path to the documents is not getting resolved and causes broken link.

Following are the screenshots:

ravir73578276_1-1672990455509.png

 

ravir73578276_0-1672990430775.png

 

How can this issue be resolved any idea?

@DivrajSingh 

 

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Employee

@ravir73578276 : If you need references to non-dita assets to work as link to assets when rendering them on AEM Site page, you need to do following:

  1. While authoring such links you need to ask authors to add an attribute "format" having appropriate value like "docx" to identify that this link is special (see [A])
  2. And before you publish the content to AEM Site, you need to add a rule in "elementmapping.xml" to indicate the publishing process to handle this differently, see [B]. With this configuration the links to docx type files will point to their original loction in AEM Assets. (note that when you update elementmapping.xml you need to follow additional notes given in Installation and Configuration guide page 106)
  3. Then you can try publishing the map to AEM Site - it should work as you expect then

[A]: authored xref with format attribute

<xref href="GUID-8e29cf2b-fa8c-4c5e-8f8f-a6c54491d33f.docx" format="docx" scope="local"> </xref>

 

[B]: snippet for elementmapping.xml to enable links to non-dita assets to work on AEM Sites

<ditaelement>

    <name>xref</name>

    <class>- topic/xref</class>

    <componentpath>fmdita/components/dita/link</componentpath>

    <type>COMPOSITE</type>

    <target>para</target>

    <textprop>text</textprop>

    <xpath><![CDATA[//xref[@format='docx']]]></xpath>

    <attributemap>

      <attribute from="href" to="link" ispath="true" rel="SOURCE" />

      <attribute from="format" to="format" />

      <attribute from="scope" to="scope" />

    </attributemap>

</ditaelement>

 

 

View solution in original post

1 Reply

Avatar

Correct answer by
Employee

@ravir73578276 : If you need references to non-dita assets to work as link to assets when rendering them on AEM Site page, you need to do following:

  1. While authoring such links you need to ask authors to add an attribute "format" having appropriate value like "docx" to identify that this link is special (see [A])
  2. And before you publish the content to AEM Site, you need to add a rule in "elementmapping.xml" to indicate the publishing process to handle this differently, see [B]. With this configuration the links to docx type files will point to their original loction in AEM Assets. (note that when you update elementmapping.xml you need to follow additional notes given in Installation and Configuration guide page 106)
  3. Then you can try publishing the map to AEM Site - it should work as you expect then

[A]: authored xref with format attribute

<xref href="GUID-8e29cf2b-fa8c-4c5e-8f8f-a6c54491d33f.docx" format="docx" scope="local"> </xref>

 

[B]: snippet for elementmapping.xml to enable links to non-dita assets to work on AEM Sites

<ditaelement>

    <name>xref</name>

    <class>- topic/xref</class>

    <componentpath>fmdita/components/dita/link</componentpath>

    <type>COMPOSITE</type>

    <target>para</target>

    <textprop>text</textprop>

    <xpath><![CDATA[//xref[@format='docx']]]></xpath>

    <attributemap>

      <attribute from="href" to="link" ispath="true" rel="SOURCE" />

      <attribute from="format" to="format" />

      <attribute from="scope" to="scope" />

    </attributemap>

</ditaelement>