<< Chapter < Page
  Cnxml tutorial   Page 1 / 1
Chapter >> Page >
This is the final installment of my three part tutorial on the CNXML language. It is currently valid for the most recent release of the language, CNXML 0.6. The keywords contain a list of the tags described in this tutorial. Along with the example code in this module there is also an example module that has been growing throughout the tutorial.

Code

The code tag is used to insert example computer output/input as either inline text within a paragraph or as ablock of text. To see which tags it may contain or be inside, consult the CNXML Spec . The code tag has a display attribute with two possible values.

  • inline (default) - used to specify code that is inline.
  • block - used to specify code that should be in a separate block of text.

<para id='copy'>In a unix terminal the command to copy a file is<code display='inline'>cp original copy</code>.</para>

In a unix terminal the command to copy a file is cp original copy

Exercise

The exercise tag provides a tag for authors to add practice problems into their documents. The exercise tag has a required id attribute and has two child tags, problem and solution .

To create more complex answers, such as multiple-choice, multiple-response, ordered-response, and text-responsequestions, QML (Questions Markup Language) may used in place of the problem and solution tags. For more information,please see the information about QML .

<exercise id='grilltest'><problem><para id='grilltestp1'>For food safety, a steak should be cooked to a minimum temperature of what?</para></problem><solution><para id='sol1p1'>160&deg; F or until the juices run clear and the meat is no longer pink.</para></solution></exercise>

For food safety, a steak should be cooked to a minimum temperature of what?

160° F or until the juices run clear and the meat is no longer pink

Cals table

CNXML uses the industry standard CALS Table Model for including tables into CNXML documents. Provided below is a brief description of the CALS tags,their attributes, and children (along with a helpful example ). For a more complete description of the CALS Table consult the CALS Table Spec .

Table

The table tag marks the beginning of a table. It has an optional first child of title and must contain one or more tgroup tags. The table tag also has many attributes, to find out more information consult the CALS Table Spec .

Tgroup

The tgroup tag marks the beginning of a new portion of a table . It has a required attribute cols which is the number of columns in the tgroup . Its children tags are zero, one, or more colspec or spanspec , zero or one thead or tfoot , and one tbody tag.

Colspec

The colspec tag is an empty tag that specificies the column of a table or entrytbl . The names and numbers specified as attributes are used for referencing by othertags.

Spanspec

The spanspec tag is an empty tag that identifies a horizontal span of columns and associatedattributes that can subsequently be referenced by its spanname for repeated use in entry or entrytbl in different rows .

Thead

The thead tag identifies the heading row of a tgroup or entrytbl . The thead tag can have zero, one, or more colspec tags and one or more row .

Tfoot

The tfoot tag identifies the rows of footer information that are displayed after the tbody . The tfoot tag can have zero, one, or more colspec tags and one or more row .

Tbody

The tbody tag identifies the body of a tgroup or entrytbl . The tbody tag must have one or more row tags.

Row

The row tag identifies the row of information in a thead , tbody , or tfoot . The row tag must have one or more entry or entrytbl .

Entrytbl

The entrytbl tag takes the place of an entry , but fits into a single row of tbody in a tgroup . The content model is the same as that of a tgroup except that tfoot is ommitted and entrytbl is self-excluding. Its children tags are zero, one, or more colspec or spanspec , zero or one thead or tfoot , and one tbody tag.

Entry

The entry tag identifies an entry in a row . The entry tag contains ASCII text and zero, one, or many cite , term , cnxn , link , code , emphasis , or media .

Using cals tables

It might sound a little confusing but I think that the best way to understand a table is to look at [link] . For more information, consult the CALS Table Spec or the CNXML Spec .

<table id='grilltemp' frame='all'><title>Steak Cooking Temperatures</title><tgroup cols='2' colsep='1' rowsep='1'><thead><row><entry>Temperature (&deg;F)</entry><entry>Description</entry></row></thead><tbody><row><entry align='center'>140</entry><entry align='center'>Rare</entry></row><row><entry align='center'>150</entry><entry align='center'>Medium Rare</entry></row><row><entry align='center'>160</entry><entry align='center'>Medium</entry></row><row><entry align='center'>165</entry><entry align='center'>Medium Well</entry></row><row><entry align='center'>170</entry><entry align='center'>Well</entry></row></tbody></tgroup></table>
Steak cooking temperatures
Temperature (°F) Description
140 Rare
150 Medium Rare
160 Medium
165 Medium Well
170 Well

Conclusions

This concludes the CNXML tutorial.

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Cnxml tutorial. OpenStax CNX. Jul 08, 2009 Download for free at http://cnx.org/content/col10121/1.10
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Cnxml tutorial' conversation and receive update notifications?

Ask