Home Forums DITA and XMetaL Discussion Outputclass dropdown options? Reply To: Outputclass dropdown options?

Derek Read

Reply to: Outputclass dropdown options?

One option (arguably the best and most proper solution) is to specialize DITA, changing this attribute from CDATA to an enumerated list. XMetaL Author displays a dropdown list in the Attribute Inspector for any attributes that are defined as an enumerated list. Specialization isn't a trivial task though, and you may not want (or be allowed by your organization) to specialize DITA for this purpose.

The Hack
If you don't want to specialize, there's a hack for this. This really is a *hack* though and I really want to stress that. Many users will be confused (possibly very confused) by this solution, but it might be better than nothing for some people (if you have a small group and everyone knows it is a hack, or perhaps just for yourself).

The solution is to piggyback on the Conditional Text feature. This feature is meant to be used for Conditional Text only, but because of the way it was written it is possible to configure it to work with any attribute, with some limitations (as noted below).

Follow the instructions in the Help topic “Working with conditions” where it talks about the “Condition configuration file” named ctconfig.xml. Instead of modifying the values for the conditional text attributes (audience, platform, product, otherprops) you can add a new section for any other attribute along with your preferred values.


Probably Confusing for Many People
The most confusing part of this solution is that to set these values while editing you do it through the Conditional Text dialog. So, if you set this solution up for anyone else you will probably want to explain that this is a hack. Also note that this doesn't change the fact that the attribute will still be CDATA in the DTD, so you will still be able to enter any valid CDATA value via the Attribute Inspector and the document will still be valid. This hack just makes it a little more convenient to select from a list than it is to type values in from memory.

The second confusing part of this is that the Conditional Text dialog displays checkboxes because the conditional text attributes (audience, platform, product, otherprops) can contain multiple values that are delimited by a space. When the DITA OT deals with the outputclass attribute it treats the entire attribute as single value. In this case radio buttons would make the most sense but there's no way to configure this dialog to do that (without modifying the source code) so you'll have to remember to select only one value. Remember, this is a hack. (have I stressed that enough?)

The Future
On behalf of people like yourself I'm arguing for a feature that would be a proper solution to aid setting this and other attributes. The problem with DITA is that almost all attributes are defined as CDATA (primarily because it makes specialization possible, but also because people need to be able to make up their own values for many things like outputclass), but at the same time people want to standardize on a given set of values AND they don't want to specialize. Such a feature would not completely restrict the allowed values, it would just help people select what you consider to be your preferred values. To restrict which values are allowed you really should consider specializing the DITA DTDs so that proper validation can be done by XMetaL Author and other validating XML parsers.