Insert GUID?

<oXygen/> general issues.
kruncher
Posts: 26

Insert GUID?

Thu Aug 02, 2012 11:21 pm

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
kruncher
Posts: 26

Re: Insert GUID?

Sat Aug 04, 2012 1:00 am

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
Radu
Posts: 5572

Re: Insert GUID?

Mon Aug 06, 2012 10:48 am

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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
kruncher
Posts: 26

Re: Insert GUID?

Mon Aug 06, 2012 4:09 pm

Okay fair enough, I will consider upgrading sometime in the future.
rdelong
Posts: 61

Re: Insert GUID?

Fri Apr 08, 2016 9:05 pm

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.
kruncher
Posts: 26

Re: Insert GUID?

Fri Apr 08, 2016 10:11 pm

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!
Radu
Posts: 5572

Re: Insert GUID?

Mon Apr 11, 2016 10:46 am

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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

Return to “Other Issues”

Who is online

Users browsing this forum: No registered users and 2 guests