Page 1 of 1

Metadata and attributes for topicref

Posted: Wed Mar 30, 2022 7:47 pm
by gbv34
Hello,
I feel confused about the attributes that could be applied to topics. Are they only intended for filtering or is it possible to use them as metadata declaration?
For instance, in the map below, I apply an audience attribute to a topicref. So far so good. I specified the attribute lockmeta for the map and I expect my topic to receive the expert value. However, this value isn't transmitted to the topic and first metadata declaration precedes, i.e. the topic receives the value novice?

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE map PUBLIC "-//OASIS//DTD DITA Map//EN" "map.dtd">
<map>
    <title>Main Map for Novice Audience</title>
    <topicmeta lockmeta="no">
        <navtitle>Simple and easy</navtitle>
        <linktext>Insert link text here</linktext>
        <shortdesc>Short description here</shortdesc>
        <audience type="novice"/> 
        <keywords>
            <keyword>Dummy-1</keyword>
        </keywords>
    </topicmeta>
    <topicref href="topic1.dita" audience="expert"/>
</map>
I presume that I confuse the use of attributes (audience, platform, otherprops) used for filtering with proper metadata declarations. If so, I guess the solution to declare and apply specific metadata to my topic would be with a prolog.

A second question that is still connected to this interrogation concerns the distinction between:

Code: Select all

<audience>novice</audience>
and

Code: Select all

<audience type="novice"/>
Do they achieve the same purpose?

Thank you so much for your feedback.

Re: Metadata and attributes for topicref

Posted: Thu Mar 31, 2022 7:26 am
by Radu
Hi,

Indeed the "@audience" attribute is a profiling attribute used mostly for filtering, it does not propagate inside the target topic.
About the "<audience>" element, I have not used it much but here's the specs:
https://www.oxygenxml.com/dita/1.3/spec ... ience.html
It needs to have empty text contents, so you can set values only to its allowed attributes.
You can set the <audience> element also directly on a topicref:

Code: Select all

  <topicref href="topics/introduction.dita">
    <topicmeta>
      <audience type="administrator"/>
    </topicmeta>
  </topicref>
About how the <audience> element should cascade from the map or topicrrefs to the referenced:
https://www.oxygenxml.com/dita/1.3/spec ... adata.html

Regards,
Radu

Re: Metadata and attributes for topicref

Posted: Thu Mar 31, 2022 12:39 pm
by gbv34
Thank you for having confirmed my doubt, Radu :)