<ph>: When and why do you use the <ph> element as a placeholder for variable content in DITA?

The <ph> element in DITA serves as a placeholder for variable content, offering flexibility in documentation that may change based on context, user input, or other factors.

Use Cases

There are several scenarios where you might use the <ph> element:

  • Conditional Content: When certain content is conditionally included or excluded in your documentation based on user preferences, platform-specific instructions, or other criteria, you can use <ph> to represent this variable content.
  • User Input: In interactive documentation, such as user guides for software applications, you might use <ph> to indicate places where users need to input specific data like names, dates, or values.
  • Localization: For multilingual documentation, you can use <ph> to mark content that will vary between translations. This helps maintain consistency in formatting while allowing for linguistic variations.

Example:

Here’s an example of how you can use the <ph> element to represent variable content in DITA:


<p>To customize your <ph>profile name</ph>, click on the <ph>Settings</ph> menu, and then select <ph>Edit Profile</ph>.</p>

In this example, the <ph> element is used to indicate that “profile name,” “Settings,” and “Edit Profile” are placeholders for variable content that can change depending on user actions or context.