• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

Learning DITA

Free DITA training

Free DITA training

  • Log in
  • Register
  • Newsletter
  • Profile
  • Privacy
  • Home
  • About
  • Courses
  • News
  • Resources
  • Support the site
  • Contact
  • Recordings

Adding advanced elements

Posted on 08.30.15

Here are some common advanced elements in DITA:

<codeblock>

The container element for a piece of code. Typically, it is rendered in a monospace font in PDF or HTML output. Placing content inside the <codeblock> element gives you control over line breaks.

<codeph> (code phrase)

The container element that displays a single word or phrase inside a <p> element as code. For example, if you mention an element in a paragraph and want to display only that element’s name in a monospace font, the <codeph> element is useful.

<lq> (long quote)

The container element for including a quote from an outside source in your content rather than (or in addition to) linking to the source.

Practice
  1. Make a copy of the file lesson4/l_concept_advanced_start.dita and open it in your editor.

    Note:

    If you are using a DITA-aware text editor, make sure you are in text mode, rather than author or visual mode.

    You should see this:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE concept PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
    <concept id="concept_advanced">
    <title>Writing about ducks</title>
    <conbody>
    </conbody>
    </concept>

    Video: Creating a codeblock in DITA
  2. Inside the <conbody> element, add the <codeblock> element and add content to it as shown in the following example:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE concept PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
    <concept id="concept_advanced">
    <title>Writing about ducks</title>
    <conbody>
    <codeblock>
    duckdata> add entry (mallard)
    ;
    1 entry added (0.05 sec)
    duckdata> _
    </codeblock>

    </conbody>
    </concept>
    The <codeblock> element isolates the piece of code content so that any tags in it exist for display purposes only and do not affect the DITA tags in your concept topic file.
    The <codeblock> element also allows you to control line breaks. In the example you added, the text inside the <codeblock> element shows an entry being added to a database using the command line.
  3. After the <codeblock> element, add a <p> element with a <codeph> element inside it and add content to it as shown in the following example:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE concept PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
    <concept id="concept_advanced">
    <title>Writing about ducks</title>
    <conbody>
    ...
    </codeblock>
    <p>To add a duck species to your database, type <codeph>add entry</codeph> followed by 
    the name of the duck in parentheses on the command line and press Enter.</p>

    </conbody>
    </concept>
    In the example you added, the <codeph> element allows you to isolate the words “add entry” and indicate that they should be displayed in a monospace font to show that they are a command.
  4. After the <p> element, add a <lq> element and add content to it as shown in the following example:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE concept PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
    <concept id="concept_advanced">
    <title>Writing about ducks</title>
    <conbody>
    ...
    </p>
    <lq href="http://classiclit.about.com/library/bl-etexts/hdthoreau/bl-hdtho-wald-9.htm" 
    format="html" scope="external">How much fairer than the pool before the farmers door, 
    in which his ducks swim! Hither the clean wild ducks come. Nature has no human 
    inhabitant who appreciates her. The birds with their plumage and their notes are in 
    harmony with the flowers, but what youth or maiden conspires with the wild luxuriant 
    beauty of Nature?</lq>

    </conbody>
    </concept>
    In the example you added, the <lq> element allows you to include a quote from Walden by Henry David Thoreau.
    The <lq> element can contain a link to the quote’s source. In the example you added, the <lq> element contains an href attribute pointing to the source URL, a format attribute indicating that the source is HTML, and a scope attribute showing that the source is external.
Contributors
  • Gretyl Kinsey, Scriptorium

sidebar

Blog Sidebar

  • Scriptorium logo
    Maximize the value of your content. Read more.
  • Scriptorium logo
    Already in DITA and need support? Contact us.
RSSTwitter

Want to add content? Join the ditatraining GitHub repository.

  • Home
  • Sponsor
  • News
  • Contact
  • Privacy
  • Cookie Policy

Maintained by Scriptorium Publishing

Logo and site presentation © 2015-2023 Scriptorium Publishing. Content based on the open-source DITA training project.

Manage Cookie Consent
To provide the best experiences, we use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us to process data such as browsing behavior or unique IDs on this site. Not consenting or withdrawing consent, may adversely affect certain features and functions.
Functional Always active
The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
The technical storage or access that is used exclusively for statistical purposes. The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.
Manage options Manage services Manage vendors Read more about these purposes
View preferences
{title} {title} {title}
Manage Cookie Consent
To provide the best experiences, we use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us to process data such as browsing behavior or unique IDs on this site. Not consenting or withdrawing consent may adversely affect certain features and functions.
Functional Always active
The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
The technical storage or access that is used exclusively for statistical purposes. The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.
Manage options Manage services Manage vendors Read more about these purposes
View preferences
{title} {title} {title}