Having real trouble with conkeyrefs

Questions about XML that are not covered by the other forums should go here.
nam
Posts: 18

Having real trouble with conkeyrefs

Tue Nov 26, 2013 10:16 pm

I am trying to use conkeyrefs, and if I can't get this to work I can just bag my project because it's success hinges on this feature. The problem I am having is multi-fold. Conkeyrefs I insert from the DITA menu don't get translated in the editor; those that I created manually get translated in the editor but don't get processed into the final document, and the one that shows in the editor as a massive error message is the only one that DOES get translated when I build the document!

This is the topic as it appears in the editor. I am using v11.2:
Image
In the title you can see the error. This is the only value that actually gets imported during translation. The green circled elements get translated in the editor, but not during the translation. The red circled elements were inserted using the editor, but they don't get translated in the editor or during document creation. Here's an image of one being inserted:

Image

To start, here is an excerpt from my ditamap:

Code: Select all


<mapref keys="project.keys"
href="../CMES-BCA_Key_Values.ditamap" format="ditamap"/>

   
<!-- The keydefs defines the location of the datafile containing window parameters/definitions extracted from the Oracle database. This line must be customized for each window P490 document-->

<keydef keys="scr490doc.g" href="P490S[G]-CMES-BCAFN110EPM-Search.dita" type="concept" format="dita" />

<keydef keys="scr490doc.c" href="P490S[C]-CMES-BCAFN110EPM-Search.dita" type="concept" format="dita" />

   
<topicref navtitle="Title Page" href="../Generic_ADnS_P490S/Generic_ADnS_P490S-0000T.dita" locktitle="yes" toc="no" type="topic" collection-type="sequence" format="dita" scope="local" />



The map appears to be correct.

here is an excerpt from one of the two concept files I am referencing:

Code: Select all

<map title="Keyword Replacement DITA Map">
    <title>BCA Common MES Replaceable Parameters</title>
   
    <keydef keys="product.acronym">
        <topicmeta>
            <keywords>
               <keyword>CMES-BCA</keyword>
            </keywords>
        </topicmeta>
        .
        .
        .


product.acronym is referenced at the bottom of the topic file as a term:

Code: Select all

<topic id="P490S-Generic_ADnS_P490S_Title_Page" >
<title>P490S <keyword keyref="scr490doc.g/scrdoc.g.title" /></title>

<shortdesc conkeyref="scr490doc.g/scrdoc.g.sdesc" />

   <body>
      <table>
         <tgroup cols="4">
            <colspec colname="c1" colwidth="1.0*"/>
            <colspec colname="c2" colwidth="1.0*"/>
            <colspec colname="c3" colwidth="1.0*"/>
            <colspec colname="c4" colwidth="1.0*"/>
            <tbody>
               <row>
                  <entry xtrc="1"><p id="9">Author</p></entry>
                  <entry xtrc="2"><p id="10">Release</p></entry>
                  <entry xtrc="3"><p id="11">Revision</p></entry>
                  <entry xtrc="4"><p id="12">Date</p></entry>
               </row>
               <row>
                  <entry xtrc="5"><p id="14" conkeyref="scr490doc.g/scrdoc.g.author" /></entry>
                  <entry xtrc="6"><p id="15">BP22.0</p></entry>
                  <entry xtrc="7"><p id="16" conkeyref="scr490doc.g/scrdoc.g.revision" /></entry>
                  <entry xtrc="8"><p id="17" conkeyref="scr490doc.g/scrdoc.g.released" /></entry>
               </row>
            </tbody>
         </tgroup>
      </table>
      <table>
         <tgroup cols="1">
            <colspec colname="c1" colwidth="1.0*"/>
            <tbody>
               <row>
                  <entry xtrc="1"><p id="28">Copyright Notice</p></entry>
               </row>
               <row>
                  <entry xtrc="2"><p id="30">Copyright &#169; 1995 - 2013 Boeing. All Rights Reserved. This document is the sole and exclusive intellectual property of The Boeing Company and may not be used or adapted for any purpose whatsoever without the prior written consent of The Boeing Company.</p>
                  </entry>
               </row>
            </tbody>
         </tgroup>
      </table>
      <p>Configuration Controlled By:</p>
      <p> <keyword keyref="product.name"/>  ( <keyword keyref="product.acronym"/> )</p>
      <p>All future revisions to this document shall be approved by the content owner prior to release.</p>
   </body>

</topic>


Earlier I referenced the green elements. They are in the table as "scr490doc.g/scrdoc.g.author", "scr490doc.g/scrdoc.g.revision", and "scr490doc.g/scrdoc.g.released".

Ok, so why does
  • scr490doc.g/scrdoc.g.title fail in the editor, but succeed during document translation,
  • scr490doc.g/scrdoc.g.author, which is referenced exactly the same way, show in the editor, but not the final document,
  • and product.acronym show up as a valid element during editing, but not get translated, ever?

I'm snookered. This makes no sense to me. I have looked at everything I could find and don't know where else to look. What kind of thing can this be caused by?

Help me Obi Wan - you're my only hope!
Neil in Washington
Radu
Posts: 5753

Re: Having real trouble with conkeyrefs

Wed Nov 27, 2013 1:38 pm

Hi Neil,

You are using a quite old version of Oxygen (11.2) with a bundled DITA OT publishing engine which probably also had some DITA 1.2 implementation bugs at that time.
I am doing most of my testing with Oxygen 15.1 so the results may differ but I will also try to quote the DITA 1.2 specification from place to place.

Let's try to address each reference problem individually:

1----------------------------------

scr490doc.g/scrdoc.g.title fail in the editor, but succeed during document translation,


The XML code for it:

Code: Select all

<keyword keyref="scr490doc.g/scrdoc.g.title" />


Oxygen 11.2 did not display content referenced with keyword keyref inline in the visual Author mode. Newer versions of Oxygen do this (probably starting with 15.0).

But in my opinion your keyword keyref reference is incorrect.
Please read this part of the DITA 1.2 specs:

http://docs.oasis-open.org/dita/v1.2/os/spec/archSpec/processing_key_references.html

For elements on which no @href attribute is available (such as cite, dt, keyword, term, ph, indexterm, index-base, and indextermref, and their specializations), matching content is taken from the <keyword> or <term> elements within <keywords> within <topicmeta>. If more than one <keyword> or <term> is present, the matching content is taken from the first of them.


So you cannot use keyword keyref to refer to some element in a topic, you can only use it to refer to an element in a topicmeta from a DITA Map.

So as an example if in the DITA Map I have a structure like:

Code: Select all

<keydef keys="scrdoc.g.title">
    <topicmeta>
      <keywords>
        <keyword>SOME CONTENT</keyword>
      </keywords>
    </topicmeta>
  </keydef>


I would refer to that content like:

Code: Select all

<keyword keyref="scrdoc.g.title" />


Basically the @keyref attribute value for a keyword always references directly a key defined in the DITA Map and takes the keyword content from the topicmeta element defined there.


2----------------------------------


scr490doc.g/scrdoc.g.author, which is referenced exactly the same way, show in the editor, but not the final document,


The XML Code for it:

Code: Select all

<p id="14" conkeyref="scr490doc.g/scrdoc.g.author" />


This is a content key reference which maps to the key definition:

Code: Select all


<keydef keys="scr490doc.g" href="P490S[G]-CMES-BCAFN110EPM-Search.dita" type="concept" format="dita" />



and then in the P490S[G]-CMES-BCAFN110EPM-Search.dita topic if a p element with the ID scrdoc.g.author exists then the reference should be valid. You did not paste code from that topic so I cannot be sure.

If this does not show up during publishing, maybe this is a bug in the open source DITA OT publishing engine which came with Oxygen 11.2. Maybe you should try to publish using a newer version of the DITA OT (1.7 or 1.8). Oxygen 15.1 comes with DITA OT 1.7.


3----------------------------------


and product.acronym show up as a valid element during editing, but not get translated, ever?


The XML code for this:

Code: Select all

<keyword keyref="product.acronym"/>


which points to a key defined here:

Code: Select all

    <keydef keys="product.acronym">
        <topicmeta>
            <keywords>
               <keyword>CMES-BCA</keyword>
            </keywords>
        </topicmeta>


The reference looks correct, according to what I explained in the first case.
In this case the keyword element should be replace in the generated output with the text "CMES-BCA".
So again, you should try to publish using a newer DITA OT or a newer Oxygen version which comes with a newer DITA OT.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
nam
Posts: 18

Re: Having real trouble with conkeyrefs

Wed Nov 27, 2013 8:51 pm

Radu,
First - let me apologize for the extremely poor grammar. I should have proof-read more carefully. When I re-read it it was painful! :shock: :shock:

Thanks for your response. After reading it and some other sources, I think understand I some of my problems.
  • Concepts are whole elements only - not partials. So you can't insert elements from a concept file into the middle of an element in the target.
  • Replaceable parameters such as "author", "version", etc. must go into a ditamap - from where they can be inserted into an element in a target file.
  • Therefore, I need both ditamap(s) and concept files.
I modified my code and got rid of the errors the editor was presenting. It still doesn't work, but that may be an issue with the version I am using. Upgrading oXygen is out of the question for the moment (I am subsidizing my $80billion/year employer by using my own Mac to do this while I work through the proof-of-concept phase. I'm not spending personal funds to assist the company when the CEO makes $27mil a year! Let HIM donate 100 seconds worth of salary for the upgrade!) But I will try getting a preview license to see if that is the issue.

Thanks for your help.
Neil in Washington
Radu
Posts: 5753

Re: Having real trouble with conkeyrefs

Thu Nov 28, 2013 12:28 pm

Hi Neil,

Concepts are whole elements only - not partials. So you can't insert elements from a concept file into the middle of an element in the target.


You can define IDs on elements inside concepts/topics and so on and you can include those elements from some place else using conrefs or conkeyrefs. But not using keyrefs.

Replaceable parameters such as "author", "version", etc. must go into a ditamap - from where they can be inserted into an element in a target file.


If you use keyrefs to refer to them, then yes. If you use conkeyrefs or conrefs, you can also have them as elements in a concept/topic and so on.

But I will try getting a preview license to see if that is the issue.


Sure, you can get a trial license and also test things with Oxygen 15.1.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

Return to “General XML Questions”

Who is online

Users browsing this forum: No registered users and 1 guest