xref with keyref to a URL?


Chris Brand
 

Hi

 

Somehow I am at a loss here. I have various support URLs that I try to keyref and profile. I defined the keys but when I insert the key as an xref so that the link becomes clickable, I get the error "Target key definition does not specify a reference". Of course I can insert it as plain text but that's a bit sad since it is a link a user expects to click on.

 

I also tried to conkeyref the whole URL. That works only once as I can have only one ID in content, even when I profile the others.

 

My keydefs look like this:

 

<keydef keys="support" branding="aaa">
     
<topicmeta>
       
<linktext>www.url-1.com</linktext>
     
</topicmeta>
   
</keydef>
   
<keydef keys="support" branding="bbb">
     
<topicmeta>
       
<linktext>www.url-2.com</linktext>
     
</topicmeta>
   
</keydef>
   
<keydef keys="support" branding="ccc">
     
<topicmeta>
       
<linktext>www.url-3.com</linktext>       
      
</topicmeta>

    </keydef>

 

When inserting as xref, it looks like this:

 

<xref keyref="support" format="html" scope="external"/>

 

It clearly misses the href attribute so it cannot know where to point to. But even if I add href manually it still complains.

Is this even possible to keyref an URL to some page within an xref?

 

I am on latest Oxy and DOT 2.5.4.

 

Thanks for pointers.

Chris.

 


Kristen James Eberlein
 

Chris, you've got the syntax wrong. If you want to use a key reference for a URN (as opposed to variable text), then you need the following mark up

<keydef keys="support" href="myURL.com"/>

Unless you are using a key definition for variable text, the @href attribute is necessary.

If you want link text, then use the following mark up:

<keydef keys="support" href="myURL.com">
    <topicmeta>
        <linktext>This text will be displayed as the link text for the cross reference</linktext>
    </topicmeta>

</keydef>

Best,
Kris

Kristen James Eberlein
Chair, OASIS DITA Technical Committee
OASIS Distinguished Contributor
Principal consultant, Eberlein Consulting LLC
www.eberleinconsulting.com
+1 919 622-1501; kriseberlein (skype)


On 8/10/2021 2:52 AM, Chris Brand via groups.io wrote:

Hi

 

Somehow I am at a loss here. I have various support URLs that I try to keyref and profile. I defined the keys but when I insert the key as an xref so that the link becomes clickable, I get the error "Target key definition does not specify a reference". Of course I can insert it as plain text but that's a bit sad since it is a link a user expects to click on.

 

I also tried to conkeyref the whole URL. That works only once as I can have only one ID in content, even when I profile the others.

 

My keydefs look like this:

 

<keydef keys="support" branding="aaa">
     
<topicmeta>
       
<linktext>www.url-1.com</linktext>
     
</topicmeta>
   
</keydef>
   
<keydef keys="support" branding="bbb">
     
<topicmeta>
       
<linktext>www.url-2.com</linktext>
     
</topicmeta>
   
</keydef>
   
<keydef keys="support" branding="ccc">
     
<topicmeta>
       
<linktext>www.url-3.com</linktext>       
      
</topicmeta>

    </keydef>

 

When inserting as xref, it looks like this:

 

<xref keyref="support" format="html" scope="external"/>

 

It clearly misses the href attribute so it cannot know where to point to. But even if I add href manually it still complains.

Is this even possible to keyref an URL to some page within an xref?

 

I am on latest Oxy and DOT 2.5.4.

 

Thanks for pointers.

Chris.

 


stinakab
 

Hi Chris,

What Kristen wrote...

... and for URLs referring to HTML web pages, I would also add the scope and format attributes to the keydef element.
When you run the transformation, your xref should be filled with all defined attributes.

Rgds,
Christina


Chris Brand
 

Christina, Kristen

 

THAT'S a lot better!! Thanks very much, you made my day.

 

Greez,

Chris.

 

Von: main@dita-users.groups.io <main@dita-users.groups.io> Im Auftrag von stinakab via groups.io
Gesendet: Dienstag, 10. August 2021 14:00
An: main@dita-users.groups.io
Betreff: Re: [dita-users] xref with keyref to a URL?

 

Hi Chris,

What Kristen wrote...

... and for URLs referring to HTML web pages, I would also add the scope and format attributes to the keydef element.
When you run the transformation, your xref should be filled with all defined attributes.

Rgds,
Christina