DITA and XMetaL Discussion

XMetaL Community Forum DITA and XMetaL Discussion How to hide attributes in inspector with XMetaL Author DITA 5.1?

  • ghkrause

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

    Participants 3
    Replies 4
    Last Activity 12 years, 7 months ago

    There are references in files and manuals to use settings in some option files but all of this seem deprecated in XMetaL Author DITA 5.1. The class attribute as well as xtrc and xtrf are not displayed in attribute inspector but I would like to hide these attributes, too: base, props, xml:lang, dir, translate, platform, product.


    S. Strube

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

    Create a macro “On_Update_ElementList”

    var elemList = Application.ElementList;
    var i;

    for( i=elemList.count-1; i >= 0; i– )
    if( elemList.item( i ).name == “whatever” || elemList.item( i ).name == “whatelse”)
    elemList.RemoveItem( i );


    Su-Laine Yeo

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

    A few releases ago, XMetaL introduced a checkbox in Tools > DITA Options to show/hide DITA specialization attributes in the Attribute Inspector. This feature hasn't been deprecated; it still works in 5.1 and in the soon-to-be-released 5.5.

    There are two reasons you're still seeing the attributes that you're seeing if you have the preference set to hide DITA specialization attributes:

    1) The feature was designed for DITA 1.0. The DITA 1.1 specification introduced some new specialization attributes such as base and props, but we haven't yet extended the feature to make it apply to those attributes as well.

    2) The attributes xml:lang, dir, translate, platform, and product are not specialization attributes, and are intended for direct use by authors. We don't often get requests to hide these attributes. If you want them to not appear in the Attribute Inspector, I think you'll have to create a specialization that does not have the attributes.


    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:


    //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);


    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 to: How to hide attributes in inspector with XMetaL Author DITA 5.1?

    Thank you Derek, I understand your remarks and will try your code. The purpose of hiding is to help parttime authors to stay focused on their writing task without restricting the experts from using the full range of attributes.
    We do analyse DITA code to check for our rules and allow experts to do everything. Of course, the system is not foolproof and we did not anticipate every possible wrong setting of hidden attributes.


  • You must be logged in to reply to this topic.

Lost Your Password?