Page 1 of 1

Insert GUID?

Posted: Thu Aug 02, 2012 11:21 pm
by kruncher
Hi guys

Is it possible to insert a unique GUID into XML documents when editing? I would like to add unique GUID's in my DITA documentation for the topic id attribute.

In NotePad++ there there is a simple plugin that generates and inserts a GUID at the caret position. I was able to map this to a keyboard shortcut which is very useful.

I am still using Oxygen 10.3, is this possible?

Many thanks

Re: Insert GUID?

Posted: Sat Aug 04, 2012 1:00 am
by kruncher
No worries, I have created a simple application that generates and pastes GUIDs automatically using a hotkey.

I have uploaded the application to GitHub for anybody interested:
https://github.com/kruncher/guid-generator-hotkey

Re: Insert GUID?

Posted: Mon Aug 06, 2012 10:48 am
by Radu
Hi Lea,
I am still using Oxygen 10.3, is this possible?
If you had a newer Oxygen version (I think 13.0 or newer) you would just have to open the new file template used to create DITA topics:

OXYGEN_INSTALL_DIR/frameworks/dita/templates/topic/Topic.dita

and its content contains an editor variable like:

Code: Select all


.....
<topic id="topic_${id}">
.....
and change it to use the ${uuid} editor variable like:

Code: Select all


.....
<topic id="topic_${uuid}">
.....
Then when creating new topics the editor variable would get expanded to an UUID.

Regards,
Radu

Re: Insert GUID?

Posted: Mon Aug 06, 2012 4:09 pm
by kruncher
Okay fair enough, I will consider upgrading sometime in the future.

Re: Insert GUID?

Posted: Fri Apr 08, 2016 9:05 pm
by rdelong
I know that I'm responding to a very old post, but the subject matter is relevant today. We are using Oxygen 17.1 and have a need for our writers to insert GUID as target IDs for our conrefs. Our developer suggested that we access an external site to generate unique GUID values, copy the value, and then paste the value into our conref targets. I find this method to be awkward.

Is there a way to get Oxygen to generate these values on the fly? I'm thinking of a keyboard shortcut or XML snippet. I really have no clue how this can be done.

Thanks for the feedback.

Re: Insert GUID?

Posted: Fri Apr 08, 2016 10:11 pm
by kruncher
I stopped using <oxygen/> a long time ago in favour of the likes of Sublime and VSCode (which have GUID generator plugins); however, back when I was experiencing this limitation in <oxygen/> I did make a little tool to ease this process.

Essentially you run the tool; and then you use Ctrl+Shift+V in any other program on Windows and it will insert a fresh GUID:
https://github.com/kruncher/guid-generator-hotkey

I hope that this helps with your needs!

Re: Insert GUID?

Posted: Mon Apr 11, 2016 10:46 am
by Radu
About the question asked by Rick:

So a DITA @conref attribute has the following syntax:

conref="path/to/topic.dita#topicID/elementID"

The topicID is the ID attribute set on the <topic> element and the elementID is the ID attribute set on the target element.
So what you would actually want would be to generate ID attributes according to the UUID pattern on XML elements, right?
In the DITA main menu there is an ID Options dialog in which you can set the ID pattern to be:

${localName}_${uuid}

then if you right click inside any DITA element and choose Generate IDs an ID with that specific pattern will be generated for the element.

Regards,
Radu

Re: Insert GUID?

Posted: Fri Sep 17, 2021 9:52 pm
by jopakent
Hello,
I am facing the exact opposite issue. I'm not sure how but when our authors create conrefs, sometimes, O2 uses a GUID for the ID.

I want that NOT to happen. We often run into merge issues that require me to fix a mess of broken conrefs. Without some clue from the conref ID, it's sometimes very, very difficult to figure out what the conref is.

So the human readable ID is what we need. Is there a way to disable the GUID insertion in O2?

I believe most our writers are using a recent version.

Thanks,
JPK

Re: Insert GUID?

Posted: Mon Sep 20, 2021 8:22 am
by Radu
Hi,

So looking at a conref value:

Code: Select all

conref="path/to/topic.dita#topicID/elementID"
do you want to disable the random ID generation for the topic ID or for the element ID?
If you want it disabled for the element ID, if you open a DITA topic in the Author visual editing mode, in the "DITA" main menu there should be an "ID Options..." action allowing you to disable auto generation of IDs on elements.

Regards,
Radu