Unable to insert a keyword reference

Having trouble installing <oXygen/>? Got a bug to report? Post it all here.
robsfl
Posts: 5

Unable to insert a keyword reference

Thu Oct 09, 2014 5:12 pm

Hi all,
I am new to Oxygen and have run into a problem I cannot resolve.

In the ditamap I have defined keywords like the following:

Code: Select all

<keydef keys="In_Type" processing-role="resource-only" class="+ map/topicref mapgroup-d/keydef ">
        <topicmeta class="- map/topicmeta ">
            <keywords class="- topic/keywords ">
                <keyword class="- topic/keyword ">600PS</keyword>
            </keywords>
        </topicmeta>
    </keydef>


In the Topic I try to insert a corresponding keyword reference that should look like this:

Code: Select all

<keyword keyref="In_Type"/>


However, when I access the keyref dialog (in our German UI it is called "Inhalt der Schlüsselreferenz einfügen") and select a key from the map then the error message "Select an element ID by pressing the subtopic button" is displayed. This makes no sense and when I do press that button I have only one option for selection in that dialog and it always results in an invalid reference being inserted. Where am I going wrong?

Robert
Radu
Posts: 5088

Re: Unable to insert a keyword reference

Fri Oct 10, 2014 8:55 am

Hi Robert,

You are using the wrong dialog. That dialog is for inserting content key references. What you actually want is to insert a key reference.
On the Oxygen toolbar there is a drop-down button containing link actions among which the action called in German Schlüsselreferenz.... Please try to use that instead to select the key and then to set the name of the element which will get inserted.

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

Re: Unable to insert a keyword reference

Mon Oct 13, 2014 11:20 am

Hi Radu,

regrettably this was only partially successful. I found this dialog in the menu DITA > Link > Schlüsselreferenz. However, it inserts an xref link like the following:

Code: Select all

<xref keyref="..."/>


The key value is generated correctly in the output but is formatted like a link (i.e. blue). Is there a way to use the keyword element to insert just unformatted text such as a product name?

BR,
Robert
Radu
Posts: 5088

Re: Unable to insert a keyword reference

Mon Oct 13, 2014 11:23 am

Hi Robert,

Yes, you need to insert a <ph> with a keyref to the metadata set on the topicref, something like:

Code: Select all

<ph keyref="..."/>


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

Re: Unable to insert a keyword reference

Mon Oct 13, 2014 11:32 am

Thanks it works now this way!

Robert
Radu
Posts: 5088

Re: Unable to insert a keyword reference

Fri Dec 18, 2015 2:38 pm

Hi,

Just to update this thread, in Oxygen 17.1 we merged the dialogs for inserting conrefs and inserting keyrefs into one Reuse Content dialog letting you focus more on your work and less on the type of construct necessary.

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

Re: Unable to insert a keyword reference

Tue Aug 22, 2017 8:08 pm

Hi there,

I am facing the same problem. I want to insert the keyword reference without having to type, say,

Code: Select all


<keyword keyref="component-name"/>


in the Text mode.

I would rather prefer inserting keywords from a UI by using some keyboard shortcut. However, if I select <menucascade><uicontrol>Link</uicontrol><uicontrol>Key Reference...</uicontrol><menucascade>, I have to select <b>keyword</b> from the <uicontrol>Element name:</uicontrol> list every time I insert the keyword tag. This is tiresome.

Is there any way to speedup this action? It would've been great if I could select the keyword straightforward without having to specify the element name.

Thank you.
Radu
Posts: 5088

Re: Unable to insert a keyword reference

Wed Aug 23, 2017 9:00 am

Hi,

If you only have a handful of keys you usually refer, in the Oxygen Preferences->Editor / Templates / Code Templates page you can define a code templates with custom names and which insert custom XML fragments.
After this in the Text editing mode you can use CTRL-SPACE to show the code templates and in the Author visual editing mode you can press ENTER and the defined code templates should be present in the list of insert-able items.
In Oxygen 19.0 we added a specialized view called "DITA Reusable Components" which shows all keys and allows you to insert keyrefs either by double clicking or by right clicking a key.
But again the double click on the key will prefer to insert a <ph keyref> to the key. Is there a reason why you prefer to insert the <keyword keyref> instead of the <ph keyref>? Do you need the extra semantic for anything? From what I remember the published output should look the same by default.

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

Re: Unable to insert a keyword reference

Wed Aug 23, 2017 4:35 pm

Thanks, Radu!

Exactly what I needed. For those interested, there is a video that outlines the details on creating code templates.

About choosing he <keyword keyref> instead of the <ph keyref>. Didn't know that. I've just started with Inserting and Defining Keys in DITA Maps and didn't have a clue that using phrase tag is a preferable way. Thanks for the help, the Working with Variable Text in DITA helped here.
Exotic Hadron
Posts: 24

Re: Unable to insert a keyword reference

Wed Aug 23, 2017 4:42 pm

Hi again, Radu.

If possible, would you please highlight the differences/advantage of using <ph keyword> instead of <keyword keyref>? I mean, would changing this everywhere in out DITA files worth the effort? Personally, I prefer sticking to the standard, but there's a good chance some in our organization would not love extra work. So I am trying get myself prepared with arguments.

Thanks.
Radu
Posts: 5088

Re: Unable to insert a keyword reference

Thu Aug 24, 2017 7:53 am

Hi,

The difference between using ph with keyref and keyword with keyref is semantics. It's the same difference between using <ph> in your topics or <keyword>.
Let's say I use <keyword with keyref>, after publishing to XHTML the published output contains:

Code: Select all

<span class="keyword">value</span>


I can match this particular @class attribute value with the CSS and style it in a certain way.
Also from what I remember the Oxygen WebHelp search indexer will give higher weight to words surrounded by the <keyword> text and promote topics containing them in the list of search results when searching for that particular word.
But if you want your small reused phrase to just be part of the paragraph text using <ph with keyref> should be fine.

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

Re: Unable to insert a keyword reference

Thu Aug 24, 2017 1:16 pm

Thank you to explain this!

Return to “Common Problems”

Who is online

Users browsing this forum: No registered users and 2 guests