DCF (Doctype Configuration Files) allow us to specify certain traits that should help a user in writing their content.
One of them is the element <AttributeOption> which - amongst others - allows us to hide an attribute from being displayed in both the structure view and the attribute window (for example to prevent the user from filling out unnecessary fields which aren't being used, or even to make sure they use the correct field if multiple ones with similar names are present).
This element allows one of two behaviors:
The option is applied globally; no matter where the attribute appears.
The option is applied to a list of specified elements, to be even more precise where certain attributes are shown/hidden.
Currently, picking one mode over the other is done by adding the child element <ElementListItem> and specifying the element name (as many times as there are elements).
However, this list is checked against the DTD or XML Schema of the document, effectively removing any <ElementListItem> occurrences for elements that do not appear in the document type.
In the worst case scenario, none of the elements appears in the DTD/XSD and the option intended as being element specific is now treated as global; applying to every single occurrence of the attribute.
Reproducing this is as easy as creating an <AttributeOption> with a single <ElementListItem> that has its element name mis-spelled.
This effectively prevents us (and some of our customers) from creating a common DCF module that is reused across multiple document types and intends to provide a complete list of options (in a single place) across a set of document types of the same standard (such as DITA, S1000D or others), as there is bound to be a document type where none of the elements listed exist.
We reported this as issue in Case C15140270, but unfortunately got the response that this is currently working as designed and may even break someones usecase if it were changed.
Due to that, we're proposing a new optional attribute on <AttributeOption> to specify the desired intended behavior. Not sure which one will be the most sensible option (so please leave a reply if you have an opinion; or an alternative way of specifying this), but those are the ones we thought up:
<AttributeOption onlyForDefinedElements="yes">: possible values are "yes" and "no" (default)
<AttributeOption application="element">: possible values are "element" (or perhaps "element-list") and "global" (default)
<AttributeOption ignoreWhenElementListIsEmpty="yes">: possible values are "yes" and "no" (default)
When set, and the list of <ElementListItem> converges on an empty list, the <AttributeOption> is effectively considered to not apply anywhere (instead of applying everywhere). For backwards-compatibility, this option defaults to the equivalent of using a global option.