• 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 simple tables to a concept topic

Posted on 08.30.15

Adding simple tables to a concept topic
Lesson Progress
0% Complete

There are two elements available for creating tables in a concept topic: <simpletable> and <table>.

Use the <simpletable> element whenever you can, especially for short tables. Use the <table> element for larger tables or tables that need more complex formatting.

The elements contained in the <simpletable> element include:

<sthead>

The container element for the header row of a <simpletable> element. The <sthead> element contains the <stentry> element and is optional. There can only be one <sthead> element in a <simpletable> element.

<strow>

The container element for the body rows of a <simpletable> element. The <strow> element contains the <stentry> element. A <simpletable> element can have one or more <strow> elements.

<stentry>

The container element for a single cell in a <simpletable> element. The <stentry> element contains the text of a cell in the <simpletable> element, which should be wrapped in a <p> element according to best practice.

This lesson will cover the basics of using the <simpletable> element.

Figure 1. Example <simpletable> in a visual format

Continue using the file lesson2/l_concept_images_tables_start.dita to add the <simpletable> and <table> elements.

Note:

If you are using a DITA editor, some child elements of the <simpletable> element will automatically be inserted as you work through the examples.

Practice
  1. Inside the <conbody> element after the <fig> element, add a <simpletable> element 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_images_tables">
       <title>Duckling growth and development</title>
      <conbody>
    ...
    </fig>
     <simpletable>
     </simpletable>

       </conbody>
    </concept>
  2. Inside the <simpletable> element, add the <sthead> element 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_images_tables">
       <title>Duckling growth and development</title>
     <conbody>
    ...
    <simpletable>
    <sthead>
    </sthead>

    </simpletable>
       </conbody>
    </concept>
    The <sthead> element sets up the header row of the <simpletable> element.
  3. Inside the <sthead> element, add two <stentry> elements and add content to them 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_images_tables">
       <title>Duckling growth and development</title>
      <conbody>
    ...
    <sthead>
    <stentry><p>Age</p></stentry>
    <stentry><p>Milestone</p></stentry>

    </sthead>
    ...
       </conbody>
    </concept>
    The <stentry> element represents a single cell. The number of <stentry> elements inside the <sthead> element will determine how many columns will be in your <simpletable> element.
    Each <stentry> element you added follows the best practice of wrapping a <p> element around the text.
  4. After the <sthead> element, add the <strow> element 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_images_tables">
       <title>Duckling growth and development</title>
       <conbody>
    ...
    </sthead>
    <strow>
    </strow>

    ...
       </conbody>
    </concept>
    The <strow> element sets up each body row following the header row of the <simpletable> element.
  5. Inside the <strow> element, add two <stentry> elements and add content to them 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_images_tables">
       <title>Duckling growth and development</title>
      <conbody>
    ...
    <strow>
    <stentry><p>7 weeks</p></stentry>
    <stentry><p>Attempt flight for the first time</p></stentry>

    </strow>
    ...
       </conbody>
    </concept>

    Every <strow> element and the <sthead> element should contain the same number of <stentry> elements.

  6. After the first <strow> element, add two more rows to the <simpletable> element and add content to them 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_images_tables">
       <title>Duckling growth and development</title>
     <conbody>
    ...
    </strow>
    <strow>
    <stentry><p>12-14 weeks</p></stentry>
    <stentry><p>Reach adult body weight</p></stentry>
    </strow>
    <strow>
    <stentry><p>1 year</p></stentry>
    <stentry><p>Capable of reproduction</p></stentry>
    </strow>

    ...
       </conbody>
    </concept>
    You can add one or more <strow> elements to a <simpletable> element.
Contributors
  • Gretyl Kinsey, Scriptorium
Previous Topic
Back to

sidebar

Blog Sidebar

  • Scriptorium logo
    Maximize the value of your content. Read more.
  • Scriptorium logo
    Need DITA help? We offer flat-rate consulting. Get help.
  • 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

Maintained by Scriptorium Publishing

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