Home Forums DITA and XMetaL Discussion How to hide attributes in inspector with XMetaL Author DITA 5.1? Reply To: How to hide attributes in inspector with XMetaL Author DITA 5.1?

Derek Read

Reply to: How to hide attributes in inspector with XMetaL Author DITA 5.1?

Both suggestions posted so far are good but here are some thoughts in how they differ:

Note that the script example posted by S. Strube modifies the element list, not the Attribute Inspector. You could create a similar script to hide specific attributes. In this case it should only be necessary to have such a script run at document open. Here is an example:
[code]


hideAttrs_945D183765F14();
]]>

//Note: function name chosen to be unique to avoid potential conflicts
function hideAttrs_945D183765F14() {
var attrsToHide = new Array(“base”, “props”, “xml:lang”, “dir”, “translate”, “platform”, “product”); //loop through the list and hide the attributes
for (i=0;i ActiveDocument.HideInAttributeInspector(attrsToHide);
}
}
]]>

[/code]

Placing an MCR file containing the code above into the Startup folder should give you what you want. Removing it will restore the default behaviour.

Note that making scripting modifications to the DITA customization beyond adding functionality as described in the file [C:Program FilesXMetaL 5.1AuthorDITAXACsditabaseditabase_ditabase.off.js] is not officially supported. If you upgrade to a newer version you will need to check that any scripts you added still function and modify them to continue working with any new functionality we might introduce. Basically we can't guarantee that we won't modify portions of the DITA system in the same way that we do try to guarantee that all of our XMetaL Author APIs as documented in the Programmer's Guide will be backward compatible between releases.

Also note that as written the script above will affect all DTDs and Schemas, not just DITA. So, if you are using other DTDs and they have similar attributes, and you do not wish to hide those attributes the script will either need to be modified to detect which DTD is loaded or turned into a document-level customization script for each DTD you wish it to affect.

The main limitation with this scripting approach is that it only hides these attributes in the Attribute Inspector. It does not stop someone from adding them in PlainText view, nor does it hide them from any of the dialogs provided for editing attributes in DITA documents. It will also not stop users from pasting XML content from other sources containing these attributes into a document. These things may or may not be desirable (the original purpose for hiding them was not described).

If they are not desirable and you wish to stop people from ever using these attributes then you will need to follow Su-Laine's recommendation and create a specialized DTD that has the attributes removed.

Reply

Products
Downloads
Support