Pages: 1
Print
Author Topic: Copy and Paste with out ids  (Read 3024 times)
MarieS
Member

Posts: 9


« on: March 10, 2010, 04:41:38 PM »

Is there a way to copy and paste content without bringing along the id value?
Logged
Derek Read
Program Manager (XMetaL)
Administrator
Member

Posts: 2621



WWW
« Reply #1 on: March 12, 2010, 12:22:39 PM »

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.
« Last Edit: March 12, 2010, 02:50:29 PM by Derek Read » Logged
dcramer
Member

Posts: 120


« Reply #2 on: March 12, 2010, 03:36:59 PM »

Quote
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
Logged

David Cramer
Technical Writer
Motive, an Alcatel-Lucent Company
Derek Read
Program Manager (XMetaL)
Administrator
Member

Posts: 2621



WWW
« Reply #3 on: March 12, 2010, 05:59:25 PM »

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.
« Last Edit: March 13, 2010, 12:06:33 PM by Derek Read » Logged
Pages: 1
Print
Jump to: