Page 1 of 1

Reset ID/IDREF when pasting

Posted: Mon Sep 29, 2014 6:38 pm
by Pascale
Would be nice to have the following improvement:
- when pasting an element that contains sub-elements with IDs and sub-elements with IDREF (in the sense of the XML ID and IDREF datatype), could you please reset all the IDs and the corresponding IDREFs so that the cross-references are preserved in the pasted XML and there is no "duplicate ID" error/conflict with the original copy.

Thanks,
Pascale

Re: Reset ID/IDREF when pasting

Posted: Tue Sep 30, 2014 8:18 am
by Radu
Hi Pascale,

In some of the XML vocabularies like DITA, Docbook, TEI for which we have out of the box document type configurations available this removal of IDs when copy/pasting in the Author visual editing mode is done by implementing a special Java extension.
For example you can look in our Author SDK at how the ro.sync.ecss.extensions.dita.id.DITAUniqueAttributesRecognizer is implemented and how it is used from the ro.sync.ecss.extensions.dita.DITAExtensionsBundle.

We could try to also provide a default implementation for this ID attributes removal functionality which would remove all attributes defined as ID-type in the schema. So I will add an improvement request for this.

Regarding IDREFS, the functionality we currently implemented for DITA, Docbook, will not remove them automatically (it only removes IDs) but you can create your own custom Java extension which also tries to remove IDREFS when they refer to IDs in the same copied content. But I don't think we can do this automatically because even if the IDREFs were not removed, they would end up pointing to IDs defined in the original content and it depends whether users would find this useful or not.

Regards,
Radu