<li>: How do you use the <li> element to define individual list items within DITA lists, both ordered and unordered?
DITA XML allows you to create structured lists, both ordered (numbered) and unordered (bulleted), to organize and present information effectively. The <li> element is an essential part of defining individual list items within DITA lists, regardless of whether they are ordered or unordered. It serves as a container for each list item’s content, ensuring that each item is correctly structured and displayed in the intended order.
Creating List Items
To create list items within a DITA list, you use the <li> element. For ordered lists, the <li> element represents each numbered item, and for unordered lists, it represents each bulleted item. You can nest various content elements inside the <li> element, such as paragraphs, links, or other elements, to provide detailed information for each list item. DITA processing systems will automatically handle the numbering or bullet points based on the list type.
Example:
Here’s an example illustrating how the <li> element is used to define individual list items within a DITA list:
<topic id="shopping_list">
<title>Shopping List</title>
<body>
<ul>
<li>Apples</li>
<li>Bananas</li>
<li>Oranges</li>
</ul>
</body>
</topic>
In this example, the DITA topic “Shopping List” includes an unordered list created with the <ul> element, and each individual item (e.g., Apples, Bananas, Oranges) is defined using the <li> element. The DITA processing system will automatically add bullet points to each item, creating a clear and organized shopping list.