Generating an ID for a topic/concept/task/etc...and DITA map

Questions about XML that are not covered by the other forums should go here.
dmbyerly
Posts: 2
Joined: Fri Mar 26, 2010 7:57 pm

Generating an ID for a topic/concept/task/etc...and DITA map

Post by dmbyerly » Fri Mar 26, 2010 8:13 pm

Firstly - I am brand new to using Oxygen. We are converting from FrameMaker.

We will use a concept as the example, but this applies to maps, references and tasks as well:

When creating a DITA concept I need to automatically generate the id at the topic level (do not want to remember to right click on the element and generate id because people never remember). I have found where I can auto generate for some of the lower level elements contained with the concept, but the concept level generates with the id assigned in the template - which is NOT unique. Maps generate with no id at all.

How do I do this? Thanks for your patience with a newb.

Radu
Posts: 7028
Joined: Fri Jul 09, 2004 5:18 pm

Re: Generating an ID for a topic/concept/task/etc...and DITA map

Post by Radu » Mon Mar 29, 2010 10:00 am

Hi,

The New Templates in Oxygen are actually XML files saved in the associated Document Types directories.
If in those XML files you use known Oxygen editor variables, they will get expanded when the file gets created to their specific value.
For example if I edit in the
OXYGEN_INSTALL_DIR/frameworks/dita/templates/topic/Topic.xml template and set its id value like:

Code: Select all


<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN"
"http://docs.oasis-open.org/dita/v1.1/OS/dtd/topic.dtd">
<topic id="topic_${timeStamp}">
<title>Topic title</title>
<body>
<p>Topic paragraph</p>
</body>
</topic>
The file template will show a validation error but when a new topic gets created from the template its id value will be unique (in this case the current system time in milliseconds).
Another editor variable which you can use is:
${date(yyyy-MM-dd)}
The pattern in the date can be very flexible, see this link:
http://java.sun.com/j2se/1.4.2/docs/api ... ormat.html

Templates for DITA Map are saved here:
OXYGEN_INSTALL_DIR\frameworks\dita\templates\map
Templates for DITA Topics are saved here:
OXYGEN_INSTALL_DIR\frameworks\dita\templates\topic

Hope this helps,
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

dmbyerly
Posts: 2
Joined: Fri Mar 26, 2010 7:57 pm

Re: Generating an ID for a topic/concept/task/etc...and DITA map

Post by dmbyerly » Mon Mar 29, 2010 4:38 pm

Thank you so much!

Post Reply