xref with keyref in a Topic file is not resolving properly in the temp files.
Posted: Wed May 03, 2023 1:20 pm
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
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