Include an xref within prodinfo/brand

Post here questions and problems related to editing and publishing DITA content.
matt_k
Posts: 34
Joined: Mon Aug 17, 2020 7:16 pm

Include an xref within prodinfo/brand

Post by matt_k »

Hi

I would like to include a URL within the prodinfo/brand element to display on the cover page. Although I have succeeded in doing this, I would like to make the URL a live clickable link.

The xref element is not valid within the brand element, so I have tried adding a keydef to the map, which references a link in variables files, like this:

Code: Select all

<keydef keys="cover_url">
    <topicmeta>
        <keywords><keyword conkeyref="url_variables/www_abc_com"/></keywords>
    </topicmeta>
</keydef>
With a keyref in the brand element like this:

Code: Select all

<brand><keyword keyref="cover_url"/></brand>
This doesn't appear to work either.

Do you have any suggestions as to how I might achieve this, please.

Thanks

Matt
julien_lacour
Posts: 564
Joined: Wed Oct 16, 2019 3:47 pm

Re: Include an xref within prodinfo/brand

Post by julien_lacour »

Hi Matt,

You cannot use <xref> directly in <brand> but you can wrap it in a <data> element:

Code: Select all

<map>
    <title>Map</title>
    <topicmeta>
        <prodinfo>
            <prodname>Some Product</prodname>
            <vrmlist><vrm version="1"/></vrmlist>
            <brand><data><xref href="https://www.oxygenxml.com" scope="external" format="html"/></data></brand>
        </prodinfo>
    </topicmeta>
</map>
Then you just need to create an XPath expression that fetches the link and use it in oxy_xpath() function as value of -oxy-link property:

Code: Select all

*[class ~= "front-page/front-page-title"] > *[class ~= "topic/title"]:after {
  display: block;
  content: "Brand: Oxygen XML";
  -oxy-link: oxy_xpath('(//*[contains(@class, " map/topicmeta ")])[1] \
  //*[contains(@class, " topic/brand ")]//@href');
  margin-top: 4em;
  text-align: center;
  color: gray;
}
Regards,
Julien
matt_k
Posts: 34
Joined: Mon Aug 17, 2020 7:16 pm

Re: Include an xref within prodinfo/brand

Post by matt_k »

Hi Julien
Wrapping the xref in the data element has worked perfectly.
Many thanks
Matt
Post Reply