How to Disable Auto-Generated unique_ Prefix IDs in Oxygen When Generating PDFs with CSS?

Post here questions and problems related to editing and publishing DITA content.
QiuLiang
Posts: 3
Joined: Thu May 15, 2025 4:00 am

How to Disable Auto-Generated unique_ Prefix IDs in Oxygen When Generating PDFs with CSS?

Post by QiuLiang »

When using Oxygen XML Editor to generate PDFs via DITA-OT with CSS customization, elements in the document (e.g., images) are automatically assigned IDs with a unique_ prefix. For example, in my DITA file, I have an image defined as:

Code: Select all

<image href="EZ60wm06130003.png" id="EZ60wm06130003"/>
However, in the generated HTML and PDF output, the ID becomes:

Code: Select all

<img class="- topic/image image" 
     dita-ot:image-width="633" 
     dita-ot:image-height="497"
     href="EZ60wm06130003.png"
     id="unique_8_Connect_42_EZ60wm06130003" 
     nd:nd-id="EZ60wm06130003" 
     placement="inline"
     src="EZ60wm06130003.png" />
I notice that Oxygen/DITA-OT adds a unique_ prefix along with chapter or context information (e.g., unique_8_Connect_42_) to the original ID. I want to preserve the original ID (i.e., EZ60wm06130003) without this auto-generated prefix.
Questions:
How can I configure Oxygen or DITA-OT (via CSS, XSLT, or other settings) to prevent the generation of unique_ prefix IDs?
Are there specific parameters, plugins, or customizations that can achieve this?
Environment Details:
Tool: Oxygen XML Editor 27.1
Any suggestions or solutions would be greatly appreciated!
julien_lacour
Posts: 677
Joined: Wed Oct 16, 2019 3:47 pm

Re: How to Disable Auto-Generated unique_ Prefix IDs in Oxygen When Generating PDFs with CSS?

Post by julien_lacour »

Hello,

By default, DITA-OT generates prefix in front of IDs to make sure the ID is unique withing the merged file.
Why do you want to remove this prefix? What are you trying to achieve?

Regards,
Julien
QiuLiang
Posts: 3
Joined: Thu May 15, 2025 4:00 am

Re: How to Disable Auto-Generated unique_ Prefix IDs in Oxygen When Generating PDFs with CSS?

Post by QiuLiang »

julien_lacour wrote: Thu May 15, 2025 10:35 am Hello,

By default, DITA-OT generates prefix in front of IDs to make sure the ID is unique withing the merged file.
Why do you want to remove this prefix? What are you trying to achieve?

Regards,
Julien
I am using Oxygen XML Editor with DITA-OT (based on HTML5 & CSS) to generate PDFs and want to display the image ID as a label below each image. In DITA Map HTML5 output, setting args.artlbl=yes achieves this, but the DITA Map PDF - based on HTML5 & CSS transformation does not support this parameter.
To address this, I implemented a CSS solution to display the image ID below the image, as shown below:

Image

Code: Select all

*[class~="topic/image"] {
  border: 1px solid #000000;
  position: relative;
}

*[class~="topic/image"]::after {
  width: 100%;
  text-align: right;
  margin-bottom: -15px;
  display: block;
  content: "[" attr(id) "]";
  font-size: 0.8em;
  color: #000000;
}
This successfully generates the ID label below the image, but the displayed ID includes a unique_ prefix and contextual information. For example:

Original DITA file: <image href="EZ60wm06130003.png" id="EZ60wm06130003"/>
PDF output ID: unique_5_Connect_42_EZ60wm06130003
1. How can I modify the CSS or DITA-OT configuration to display only the original ID (e.g., EZ60wm06130003) in the label, without the unique_ prefix and contextual information?
2. Is there a way to enable functionality similar to args.artlbl=yes in the PDF output, or an alternative parameter to natively display image IDs?
Any suggestions or solutions would be greatly appreciated!
You do not have the required permissions to view the files attached to this post.
julien_lacour
Posts: 677
Joined: Wed Oct 16, 2019 3:47 pm

Re: How to Disable Auto-Generated unique_ Prefix IDs in Oxygen When Generating PDFs with CSS?

Post by julien_lacour »

Hello,

The original ID is still present in the HTML structure expect it is in the @nd:nd-id attribute, you can fetch it by using the following CSS rule:

Code: Select all

@namespace nd url("http://www.oxygenxml.com/css2fo/named-destinations");

*[class~="topic/image"][nd|nd-id]::after {
  width: 100%;
  text-align: right;
  margin-bottom: -15px;
  display: block;
  content: "[" attr(nd|nd-id) "]";
  font-size: 0.8em;
  color: #000000;
}
I also added [nd|nd-id] in the selector so you wont get warnings on images without ID.

Regards,
Julien
QiuLiang
Posts: 3
Joined: Thu May 15, 2025 4:00 am

Re: How to Disable Auto-Generated unique_ Prefix IDs in Oxygen When Generating PDFs with CSS?

Post by QiuLiang »

julien_lacour wrote: Thu May 15, 2025 12:37 pm Hello,

The original ID is still present in the HTML structure expect it is in the @nd:nd-id attribute, you can fetch it by using the following CSS rule:

Code: Select all

@namespace nd url("http://www.oxygenxml.com/css2fo/named-destinations");

*[class~="topic/image"][nd|nd-id]::after {
  width: 100%;
  text-align: right;
  margin-bottom: -15px;
  display: block;
  content: "[" attr(nd|nd-id) "]";
  font-size: 0.8em;
  color: #000000;
}
I also added [nd|nd-id] in the selector so you wont get warnings on images without ID.

Regards,
Julien
Hi Julien,
Thank you so much for your detailed response and the solution! It works perfectly, and I really appreciate your help in resolving this issue.
Post Reply