Page 1 of 1

Unable to find target for conref in map - conrefImpl.xsl, line 296

Posted: Wed Nov 25, 2020 2:23 pm
by aaron
Hi,

I have had an issue trying to conref to a mainbooktitle.

Searching through the OT files, I have found the problem occurs on line 296 of conrefImpl.xsl (OT :3.5.4)

Code: Select all

<xsl:when test="exists($elemid)">
    <xsl:sequence select="key('id', $elemid)[contains(@class, $lastClassToken)][ancestor::*[contains(@class, ' topic/topic ')][1][@id = $topicid]]"/>
</xsl:when>
Since my mainbooktitle does not have a 'topic/topic' class ancestor, an error is returned. Is this intended?

Should I be using an xref instead? I can add

Code: Select all

 or contains(@class, ' map/map ')
and then the conref will be resolved - I dont want to have a link to the mainbooktitle, just want the text.

Re: Unable to find target for conref in map - conrefImpl.xsl, line 296

Posted: Wed Nov 25, 2020 3:11 pm
by Radu
Hi,

Can you post some small DITA snippets with how the conref looks like and how the target element looks like?
Are you making a conref from a topic to a DITA Map? Or from a map to another map?

Regards,
Radu

Re: Unable to find target for conref in map - conrefImpl.xsl, line 296

Posted: Thu Nov 26, 2020 9:36 pm
by aaron
Hi Radu,

Conref (in a topic):

Code: Select all

<title><ph conref="001-1X00376012.ditamap#X00376012/main_book_title"/></title>
Target (in a bookmap):

Code: Select all

<mainbooktitle id="main_book_title" class="- topic/ph bookmap/mainbooktitle ">Testing SS3 on SS2 bookmap</mainbooktitle>
In the Oxygen author window, the conref resolves ok - the topic title displays the text "Testing SS3 on SS2 bookmap" as it should, but it does not work with the OT. I have not tested map-map conrefs.

I am not sure if it makes any difference, but the topic containing the conref is referenced by a preface in the frontmatter.
A related issue I have noticed in preprocessing; is that while chapters in the bookmap are normally transformed into submaps, when the conref is present this does not happen.


Thanks,
Aaron

Re: Unable to find target for conref in map - conrefImpl.xsl, line 296

Posted: Fri Nov 27, 2020 8:32 am
by Radu
Hi Aaron,

When you conref to an element inside a DITA Map, you must refer directly to the element ID, without including the map ID. Here's the DITA specs:

https://docs.oasis-open.org/dita/v1.1/O ... ibute.html
Using conref to refer to an element within a map

Within a map, the conref attribute references an equivalent element in the same map or another map. The value of conref is a URI that includes (or consists entirely of) a fragment identifier consisting of the number sign ('#') followed by the ID of the target element.
So your conref should be:

Code: Select all

<title><ph conref="001-1X00376012.ditamap#main_book_title"/></title>
What Oxygen version do you have? Did you use Oxygen to insert the conref or did you type the conref value manually? If you used Oxygen's functionality to insert the conref to the element inside the DITA Map, then Oxygen has a bug.
I would also change the target of the conref to declare the @id attribute on a ph element instead:

Code: Select all

<mainbooktitle><ph id="main_book_title">Testing SS3 on SS2 bookmap</ph></mainbooktitle>
In general it is a bad idea that two topics (or in this case a topic and a map) which appear in the final publication reuse content from one another. It is recommended to have resource-only topics which are like dictionaries of reusable content, those topics contain small reusable pieces of XML. And in your case both the topic and the map would conref content from that reusable content topic. Similar to the structure here:

https://github.com/oxygenxml/dita-proje ... -practices

Regards,
Radu

Re: Unable to find target for conref in map - conrefImpl.xsl, line 296

Posted: Mon Nov 30, 2020 7:39 pm
by aaron
Excellent, thanks Radu.

I put in the conref values. I'll see if I can use a ph inside the mainbook title but I dont think the CMS system we use allows it.

BR,
Aaron

Re: Unable to find target for conref in map - conrefImpl.xsl, line 296

Posted: Fri Dec 04, 2020 10:54 pm
by chrispitude
Hi Aaron,

I find it easiest to copy the source element, then do a "Paste special" > "Paste as content [key] reference" and let Oxygen figure out exactly how to create the reference. It will sort out key scopes, topic IDs, element IDs, etc., automatically for you.

Re: Unable to find target for conref in map - conrefImpl.xsl, line 296

Posted: Mon Dec 07, 2020 12:55 pm
by aaron
Thanks Chris,

I didn't know this was available - Unfortunately the application my company uses (which has Oxygen embedded) doesn't use "pure" DITA and doesn't support conkeyrefs. :(