DITA and XMetaL Discussion

XMetaL Community Forum DITA and XMetaL Discussion Copy and Paste with out ids

  • MarieS

    Copy and Paste with out ids

    Participants 2
    Replies 3
    Last Activity 13 years ago

    Is there a way to copy and paste content without bringing along the id value?

    Reply

    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 6.0.0.122 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.

    Reply

    dcramer

    Reply to: Copy and Paste with out ids

    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.

    Interesting feature. Some questions about it:

    When was this introduced? (i.e. in what version of xmetal) I don't see it happening in 4.6 or 5.5.
    It only affects copy and paste when the paste is into the same document, correct? I.e. it happens on the paste not at the time of the copy.
    It only affects copy and not cut, correct?
    Does it happen silently or is the user notified (e.g. by a dialog or something)?
    Could it be turned off or enhanced with scripting? E.g. could you have it prompt them to approve of the change on the paste? I doubt I'd go to the trouble, just curious.

    Thanks,
    David

    Reply

    Derek Read

    Reply to: Copy and Paste with out ids

    dcramer:
    My mistake, probably due to wishful thinking that this behavior be consistent across versions for non-DITA customizations (ie: it should just automatically be done by the product with no need to add additional script as far as I am concerned).

    There is a bug report in our system related to this: PROD00025109. The validator does find these errors (F9 or upon saving) and there are no inconsistencies there as far as I know. However, if you want to aid the user in making sure there are no duplicates automatically, a similar scripting solution (to what we've implemented for DITA) could be created. I see that this limitation is still in the 6.0 release.

    Reply

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

Lost Your Password?

Products
Downloads
Support