auto-generate topicref attributes based on topic type

Post here questions and problems related to editing and publishing DITA content.
mstrubberg
Posts: 48
Joined: Sat Jan 26, 2013 6:07 pm

auto-generate topicref attributes based on topic type

Post by mstrubberg »

I want to auto-generate the attributes on a topicref based on the root element (concept, reference, or task) in the Insert Reference window.

For a topicref to a concept topic the topicref attributes would be: format=dita, type= concept, scope=local
For a topicref to a task topic the topicref attributes would be: format=dita, type= task, scope=local
For a topicref to a reference topic the topicref attributes would be: format=dita, type= reference, scope=local

How can I auto-generated these fields so that the user doesn't have to populate them?
alex_jitianu
Posts: 1008
Joined: Wed Nov 16, 2005 11:11 am

Re: auto-generate topicref attributes based on topic type

Post by alex_jitianu »

Hi,

Currently there is no way to automatically configure these attributes. I've added a feature request to provide this level of customization.

As a side note, your values for the "format" and "scope" attributes are actually the default values and because Oxygen leaves these untouched, you will obtain the same result when the reference gets processed. So you only have to worry for the "type" attribute.

Best regards,
Alex
Radu
Posts: 9053
Joined: Fri Jul 09, 2004 5:18 pm

Re: auto-generate topicref attributes based on topic type

Post by Radu »

Hi,

Just to update this discussion, Oxygen 17.1 should contain in the Preferences->DITA page preferences to automatically set default attributes for topicrefs.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
xephon
Posts: 140
Joined: Mon Nov 24, 2014 1:49 pm
Location: Greven/Germany

Re: auto-generate topicref attributes based on topic type

Post by xephon »

Well, that's OT, but for what does the OT need the

Code: Select all

type
attribute? I cannot find information about it in the spec. Is it used with relationship tables?
stefan-jung.org – Your DITA/DITA-OT XML consultant
Radu
Posts: 9053
Joined: Fri Jul 09, 2004 5:18 pm

Re: auto-generate topicref attributes based on topic type

Post by Radu »

Hi Stefan,

In the DITA OT pre-processing stage if you do not explicitly set @type attributes on references, they are deduced from the actual target. This makes sense because setting the @type attribute on each link is redundant information, the same information can be inferred by looking at the actual target element. So it's not necessary. From what I know the type information, once derived is indeed used for some static labels in the related links sections.

But, the problem is that the @type attribute cascades in the DITA Map:

http://docs.oasis-open.org/dita/v1.2/os ... tamap.html

And the problem is that other XML editors set the @type attribute on topicrefs by default.

So if somebody edits a DITA Map with a competing XML Editor, they will have in the DITA Map at some point something like:

Code: Select all


<topicref href="task.dita" type="task"/>
then they open the DITA Map in Oxygen and add a new topicref inside the existing one using the Oxygen default options, and after this the DITA Map looks like this:

Code: Select all


<topicref href="task.dita" type="task">
<topicref href="topic.dita"/>
</topicref>
Because the @type attribute cascades, the DITA OT will complain that the "topic.dita" is referenced as a task but it is in fact a topic.
So we needed to add these settings to automatically generate the @type attribute (also also @scope and @format) on topicrefs in order to be more compatible when editing DITA content created with other tools.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
xephon
Posts: 140
Joined: Mon Nov 24, 2014 1:49 pm
Location: Greven/Germany

Re: auto-generate topicref attributes based on topic type

Post by xephon »

Thanks Radu, :D

I did not know that. This cascading behavior is quite strange. So for me as a writer it is important to know, that I should ever or never use the attribute, because we publish sometimes PDF files by build script, so we sometimes do not invoke the publication via Oxygen. In that case we would be affected by this cascading issue. I have to think about it and maybe completely prohibit using the type attribute by Schematron. It seems, that this attribute is quite obsolete but error-prone for topicref elements.

Greetings,
Stefan
stefan-jung.org – Your DITA/DITA-OT XML consultant
Post Reply