DITA and XMetaL Discussion

XMetaL Community Forum DITA and XMetaL Discussion Reusable Component Question: Why the stragglers?

  • nouspoetikos

    Reusable Component Question: Why the stragglers?

    Participants 0
    Replies 1
    Last Activity 8 years, 3 months ago


    I'm wondering if you could help me with a reusable component question in XMetaL7 Author on Windows.

    I have this reusable component file created via XMetaL's 'Create Reusable Component' menu:

      test of re-usable component

    This is a conbody that I wanted to turn into a reusable component


    And the file below which includes the reusable component. If you look at the conbody element, XMetaL has automatically inserted a call to the reusable component file above. 

      Testing Re-usable Component
      Some text


    When XMetaL inserts the reference to the conref, it adds tags (without their ids or contents). In this case, the conbody has lost the id and contains a p which has equally lost its id and contents.

    When one returns to edit the file after XMetaL's initial insertion, one can remove the empty

    under without any problems. The reusable component continues to work….so clearly, the empty

    (or empty first children in the case of reusable components inserted generally) is not absolutely necessary for the resolution of the reusable component during build time.

    I have validation checks do not play well with the way XMetaL automagically inserts the re-usable components and, while it's possible to work around the reusable component context, it seems odd to me that I need to loosen the rule because the editor itself is leaving empty

    's behind. I have additional checks (on id's for example) that equally hit problems with re-usable components.

    I could ask the writers to go back in after the reusable component has been added and remove the extra tags and/or re-add the ids but that seems painful.

    Is there any way to alter the default insertion behavior so that:

    • Ids on the element referenced are retained?
      Child elements are not emptied and copied over?


    Thanks in advance for your help,




    Reply to: Reusable Component Question: Why the stragglers?


    This is a consequence of the way conrefs work. When you have an element like:

    This text is always ignored

    it tells a DITA processor to ignore whatever is inside the element, and instead to use the contents of the

    element identified by “XXX”. The situation with attributes is a bit more complex; you can see a description in section of the DITA 1.2 standard. One thing this states is that the id attribute is never copied from the referenced element. There's a good reason for this: since it may be referenced many times it could lead to duplicate identifiers. For the same reason, id attributes should be avoided within reusable content.

    The content that XMetaL is adding is purely for the convenience of the user, so something appears where the replacement will occur – it has nothing to do with the content that is actually referenced.

    I'm not sure what sort of validation you are doing, but to be correct it should either ignore the content within the conref element, or replace it with the referenced content.


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

Lost Your Password?