Home Forums DITA and XMetaL Discussion Copy and Paste with out ids Reply To: Copy and Paste with out ids

Derek Read

Reply to: Copy and Paste with out ids

The best thing to do is to upgrade to a newer version. I can't remember exactly when we added support for this (removal of the DITA id attribute) but testing just now with shows that the feature is there.

The background for this may be interesting. XMetaL Author itself automatically removes any id attribute when it is declared as type ID in a DTD during copy and paste actions. According to XML rules a document containing two identical attributes of type ID is invalid and so knowing what to do in this case is obvious in order to keep the document valid.

In DITA (in order to allow it to support specializations I believe) the id attribute is of type NMTOKEN, and so technically a DITA document containing two identical id attributes is perfectly valid — according to the XML validation rules (and XMetaL Author will tell you such a document is valid, which is true — according to the XML validation rules).

At some point we realized that most people want these values to be unique, with the most common case being that you want to link to them from some other location (often using conref) and so these values do need to be unique to fulfill that requirement (this also fulfills the DITA Architectural Specification which at some point was updated to make this explicit). The removal of these attributes is now done as part of the DITA functionality (which is script sitting outside and overriding or adding to the standard XMetaL Author behaviors).

In addition, when XMetaL Author notices that an element with an id attribute not set it checks the list of attributes you have listed in the dialog “Options: Auto-Assign Element IDs” (accessible via the Tools > DITA Options dialog). This is actually a separate function and not directly tied to the id removal, though it is triggered as a result of the id removal.