Page 1 of 1
Attribute is not allowed to appear in element "topicref".
Posted: Tue Apr 12, 2022 2:57 pm
by gbv34
Hello,
I created a subject scheme map with the following declaration:
Code: Select all
<subjectScheme>
<subjectdef keys="browserapp">
<subjectdef keys="firefox" navtitle="Firefox"/>
<subjectdef keys="chrome" navtitle="Chrome"/>
<subjectdef keys="safari" navtitle="Safari"/>
<subjectdef keys="brave" navtitle="Brave"/>
</subjectdef>
<enumerationdef>
<attributedef name="BrowserApp"/>
<subjectdef keyref="browserapp"/>
</enumerationdef>
</subjectScheme>
However, when I apply a profiling attribute to a topic referenced in a map:
Code: Select all
<topicref href="topics/brave.dita" BrowserApp="brave"/>
I notice the following message:
Code: Select all
Attribute "BrowserApp" is not allowed to appear in element "topicref".
Why couldn't I apply this new attribute to my topic ref?
Thanks a lot for your help

Re: Attribute is not allowed to appear in element "topicref".
Posted: Tue Apr 12, 2022 3:15 pm
by chrispitude
Hi gbv34,
If you want to create your own profiling attribute in DITA, you must specialize it from @props first, which means creating DITA-OT plugins to define your attribute, then defining a new document shell type that uses it.
As an alternative, you could use an existing DITA profiling attribute (like
@audience or
@deliveryTarget) to capture this information:
Code: Select all
<subjectScheme>
<subjectdef keys="browserapp">
<subjectdef keys="firefox" navtitle="Firefox"/>
<subjectdef keys="chrome" navtitle="Chrome"/>
<subjectdef keys="safari" navtitle="Safari"/>
<subjectdef keys="brave" navtitle="Brave"/>
</subjectdef>
<enumerationdef>
<attributedef name="deliveryTarget"/>
<!-- ^^^^^^^^^^^^^^ -->
<subjectdef keyref="browserapp"/>
</enumerationdef>
</subjectScheme>
If you are already using that attribute for other things, you could use DITA's support for profiling attribute groups:
2.4.3.1 Conditional processing values and groups
https://docs.oasis-open.org/dita/dita/v ... butes.html
which would let you create a "group" within the attribute, essentially acting as your own sub-attribute within that attribute:
Code: Select all
<subjectScheme>
<subjectdef keys="browserapp">
<subjectdef keys="BrowserApp(firefox)" navtitle="Firefox"/>
<subjectdef keys="BrowserApp(chrome)" navtitle="Chrome"/>
<subjectdef keys="BrowserApp(safari)" navtitle="Safari"/>
<subjectdef keys="BrowserApp(brave)" navtitle="Brave"/>
<!-- ^^^^^^^^^^ -->
</subjectdef>
<enumerationdef>
<attributedef name="deliveryTarget"/>
<subjectdef keyref="browserapp"/>
</enumerationdef>
</subjectScheme>
but this feature won't be supported in Oxygen until the v25 release.
Re: Attribute is not allowed to appear in element "topicref".
Posted: Tue Apr 12, 2022 3:36 pm
by Radu
Hi,
As Chris says, with the subject scheme map you cannot define new profiling attributes, you just define controlled values for existing profiling attributes.
But to add a new profiling attribute you need to create a DITA OT DITA specialization plugin:
http://dita4practitioners.github.io/dit ... ocess.html
and integrate it in the DITA OT publishing engine used by Oxygen:
https://www.oxygenxml.com/doc/versions/ ... ation.html
Regards,
Radu
Re: Attribute is not allowed to appear in element "topicref".
Posted: Tue Apr 12, 2022 3:59 pm
by gbv34
Thanks a lot to both of you, an excellent opportunity for me to move forward

Re: Attribute is not allowed to appear in element "topicref".
Posted: Tue Apr 12, 2022 4:54 pm
by chrispitude
And if you really want to specialize your own attribute, you can use the
make_dita_grammar.pl script to automate the plugin creation, available here:
DITA-plugin-utilities
https://github.com/chrispy-snps/DITA-plugin-utilities
You would give it input something like this:
Code: Select all
<plugin directory="./com.synopsys.docshell" uri_prefix="com:synopsys:docshell">
<attributedomain filename="BrowserAppAttMod.rng" domain="BrowserApp">
<specialize attribute="BrowserApp" from="props" model="(Firefox|Chrome|Safari|Brave)*"/>
</attributedomain>
<topicshell filename="myTopicShell.rng">
<title>My Topic</title>
<header>...some header stuff...</header>
<root_element>topic</root_element>
<include_domains>BrowserApp</include_domains>
</topicshell>
</plugin>
and it would make the DITA-OT plugin and document-type shell for you. But you would still need to follow the process in Radu's second link to use them.