xref with keyref in a Topic file is not resolving properly in the temp files.

Post here questions and problems related to editing and publishing DITA content.
koushik9020
Posts: 14
Joined: Tue Dec 06, 2022 11:21 am

xref with keyref in a Topic file is not resolving properly in the temp files.

Post by koushik9020 »

Hello Team,
We are using the old version of dita-ot-1.8.5 because of the business needs, and we have plans of upgrading this to latest versions sometime in future after the on-going priorities. Given the fact that we're using the old version of dita-ot just wanted to know this below behaviour related to xref's when used along with the keyref's:
For eg: If we have a Topic named: "preface.xml" file, inside which we defined this below xref with keyref:
<xref format="dita" keyref="GUID-23DB210A-D5A6-4F88-99C4-1C1A50E84AA9" scope="local" type="topic"/>

The actual keydef for this keyref GUID is defined in a different ditamap file which we call it as: "guids.ditamap" like below way:
<keydef keys="GUID-23DB210A-D5A6-4F88-99C4-1C1A50E84AA9" href="Audience=GUID-23DB210A-D5A6-4F88-99C4-1C1A50E84AA9=5.xml" format="dita"/>

And this "guids.ditamap" file defined as a "mapref" inside the main ditamap file of a book/document which we are providing as a input for generating the XHTML output using the customised plugin that we developed our selves in dita-ot-1.8.5 like below way:
<mapref href="guids.ditamap"/>

While running this local XHTML transformation, given below is the code snippet that's being generated for above xref inside the temp folders /preface.xml file:

<xref format="dita" keyref="GUID-23DB210A-D5A6-4F88-99C4-1C1A50E84AA9" scope="local"
type="topic"
ishlabelxpath="./title | @alt | @href | @conref | self::*[@id and not(@varid)]/@id"
ishlinkxpath="@conref | @href[contains(parent::*/@class,' topic/image ') and not(parent::*/@conref)] | @href[contains(parent::*/@class,' topic/longdescref ') and not(parent::*/@conref)] | @href[contains(parent::*/@class,' topic/longquoteref ') and not(parent::*/@conref)]"
ishhyperlinkxpath="@href[not(ancestor::*[@scope and @scope!=''][position()=1]/@scope='external')]"
class="- topic/xref "
xtrf="/Users/koushiktm/Desktop/projects/dita-ot-1.8.5/ditaroot/DPS-107510/xml/Preface=GUID-570652A6-7C8D-45F8-BE53-76FFEE7CF8CC=5.xml"
xtrc="xref:1;14:110" href="Audience=GUID-23DB210A-D5A6-4F88-99C4-1C1A50E84AA9=5.xml"
ishtype="ISHSection">Audience</xref>

It's generating both keyref & href inside the temp file/intermediate file which is causing the problem to resolve the href links as the generated html href link looks like below way:
<a href="Audience=GUID-23DB210A-D5A6-4F88-99C4-1C1A50E84AA9=5.html">Audience</a>
And since this file is not generated in the output folder, this gives us 404 error when this link is clicked up-on.

-----

But where as when we use the xref with href instead like below way , this is working as expected:
xref defined inside the same preface.xml Topic file: <xref cid="1Hnyu0" format="dita" href="audience.xml" scope="local" type="topic"/>

Generated temp/intermediate file code snippet looks like below way:

<xref cid="1Hnyu0" format="dita"
href="preface.xml#GUID-23DB210A-D5A6-4F88-99C4-1C1A50E84AA9"
scope="local" type="topic"
ishlabelxpath="./title | @alt | @href | @conref | self::*[@id and not(@varid)]/@id"
ishlinkxpath="@conref | @href[contains(parent::*/@class,' topic/image ') and not(parent::*/@conref)] | @href[contains(parent::*/@class,' topic/longdescref ') and not(parent::*/@conref)] | @href[contains(parent::*/@class,' topic/longquoteref ') and not(parent::*/@conref)]"
ishhyperlinkxpath="@href[not(ancestor::*[@scope and @scope!=''][position()=1]/@scope='external')]"
class="- topic/xref "
xtrf="/Users/koushiktm/Desktop/projects/dita-ot-1.8.5/ditaroot/DPS-107510-SDL/xml/preface.xml"
xtrc="xref:1;1:1040">Audience</xref>

Which resolves properly in the XHTML output like below way:
<a href="preface.html#GUID-23DB210A-D5A6-4F88-99C4-1C1A50E84AA9">Audience</a>

As we can see above href is directly pointing to that GUID of audience section with a # tag before it along with parent 'topicname.html' in this case preface.html , which resolves properly to that section when clicked up-on.


How can we make sure we can generate the same code snippet inside the temp/intermediate files while using xref with keyref similar to that of href.

Kindly suggest if there's any workaround to be used in this old version of dita-ot-1.8.5.


Thanks & Regards,
Koushik
chrispitude
Posts: 907
Joined: Thu May 02, 2019 2:32 pm

Re: xref with keyref in a Topic file is not resolving properly in the temp files.

Post by chrispitude »

HI Koushik,

Just curious - does the latest DITA-OT publish this properly? If so, then this is a bug with the older DITA-OT and there probably is not much you can do about it (other than modify the DITA-OT code yourself to fix it).

- Chris
Radu
Posts: 9059
Joined: Fri Jul 09, 2004 5:18 pm

Re: xref with keyref in a Topic file is not resolving properly in the temp files.

Post by Radu »

Hi Koushik,
DITA OT 1.8.5 is deprecated and we no longer support it in any way.
You seem to be using Oxygen with SDL, ideally you should create a minimal DITA project on your local disk (so taking the CMS out of the equation) to reproduce the problem. If you can still reproduce the problem with DITA OT 1.8, you can later try with a newer DITA OT distribution like DITA OT 3.7 like Chris suggested.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
koushik9020
Posts: 14
Joined: Tue Dec 06, 2022 11:21 am

Re: xref with keyref in a Topic file is not resolving properly in the temp files.

Post by koushik9020 »

Thank you Chris/Radu for your reply about this.
I tried to download the DITA-OT 3.7 to my local and tried to setup a book to reproduce the problem there, but ended up with some error in the book setup(which I'm not able to resolve it). Could you please help me with the setup of the simple book with the keyref use-case with xref to confirm this behaviour.

Regards,
Koushik
Radu
Posts: 9059
Joined: Fri Jul 09, 2004 5:18 pm

Re: xref with keyref in a Topic file is not resolving properly in the temp files.

Post by Radu »

Hi Koushik,
I'm not sure how I can help further, the content is yours and you need to reduce it to a smaller content (map and 1-2 topics) which exhibits the same problem. You can use Oxygen's "Validate and check for completeness" action from the DITA Maps Manager view to check if the reduced content is valid and to see what validation problems it has.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply