Document History

Introduction

This specification defines version 0.5 of the Connexions Markup Language (CNXML), an XML application for marking up educational texts. It is designed for use in the Connexions Project, but we are making it generally available in the hopes that others may find it useful. CNXML marks up the structure and semantic content of a document and encourages the separation of content from presentation. It contains few (if any) elements that deal with style or presentation. Decisions about how to display CNXML documents should be made elsewhere (in a Style Sheet, for example.)

CNXML Tags

Attributes

Each CNXML element may have several attributes, some of which are required and some are optional. In the following sections, each element is listed with its accompanying attributes. The attributes can be one of several types (see the XML specification for details on what these mean) :

  • ID - an identifier. Must be unique within the document
  • IDREF - refers to an ID attribute
  • CDATA - character data (text)
In addition to these types, some attributes must take a value from a predefined set.

Tag Groupings

CNXML 0.5 introduces the notion of tag groupings. In order to simplify the rules for nesting tags, we have created three groups of tags. Each CNXML element belongs to one of the three groups. This group will determine the children that can be nested in the tag. The actual nesting rules will be explained further below. The groupings are:

Structural Tags

Structural tags are called so because they are containers for almost all other tags. The following tags are considered structural tags: Structural Tags: content; section; example; meaning; proof; statement; problem; solution. Structural tags can contain tags the following children:

Any tag that is listed, or is in one of the groups listed above can be nested as a child of a structural tag.

Note:

All structural tags can have the name tag as their first child.

Example 1: Tag Grouping Nesting Example

Section is a structural tag, which therefore allows it to have either para, special, or other structural children as it's children. Therefore, you could have a section with a figure as a child, since figure is a special tag and structural tags are allowed to have special tags as children.

section

Description

The section tag is used to divide a document into sections, as its name suggests.

Attributes

  • id - unique id
    • Required
    • ID

Type

Structural

Contained Within:

Children

The section tag may have an optional name tag as its first child followed by a combination of Structural Tags.

Example 2

	  
	<section id="res">
	  <name>Resistor</name> 
	  <para id="para2">
	  .
	  .
	  .
	  </para>
	</section>
	<section id="cap">
	  <name>Capacitor</name>
	  <para id="para3">
	  .
	  .
	  .
	  </para>
	</section>
	<section id="ind">
	  <name>Inductor</name>
	  <para id="para4">
	  .
	  .
	  .
	  <para>
	</section>
	  
	

example

Description

The example tag is used to contain an example of something. This is especially useful in connection with the definition tag where it can be used to give an example of the meaning of a term.

Attributes

  • id - unique id
    • Required
    • ID

Type

Structural

Contained Within:

Children

See structural tags.

Example 3

	  
	<example id="example">
	  <para id="paraex1">
	    The Lincoln Memorial is an example of a monument.
	  </para>    
	</example>
	  
	
Example 4

The Lincoln Memorial is an example of a monument.

exercise

The exercise tag is used to create exercises, such as would be used in a text book of a college course. An exercise consists of two parts: a problem and a solution.

Attributes

  • id - unique id
    • Required
    • ID

Type

Special

Contained Within:

Children

An exercise may contain a problem followed by zero or more optional solutions.

problem

Description

The problem tag is used to specify the problem portion of an exercise tag.

Attributes

None

Type

Structural

Contained Within:

Children

See structural tags.

Example 5

	  
	<problem>
	  <para id="prob_1">
	    What is the capital of Texas?
	  </para>
	</problem>
	  
	

solution

Description

The solution tag is used to specify the solution portion of an exercise tag.

Attributes

None

Type

Structural

Contained Within:

Children

See structural tags.

Example 6

	  
	<solution>
	  <para id="sol_1">
	    Austin is the capital of Texas.
	  </para>
	</solution>
	  
	
Example 7
Problem 1

What is the capital of Texas?

Solution

Austin is the capital of Texas.

proof

Description

The proof tag contains the proof or explanation of a rule tag.

Attributes

  • id - a unique identifier
    • Optional
    • ID

Type

Structural

Contained Within:

Children

See structural tags.

Examples

See the example for rule.

statement

Description

The statement tag is used inside the rule tag. It is used to write a definition or description of the rule in which it is placed.

Attributes

  • id - a unique identifier
    • Optional
    • ID

Type

Structural

Contained Within:

Children

See structural tags.

Examples

See the example for rule.

Inline Tags

Inline tags are used inside of paragraphs and anywhere else that it is necessary to add content to text. The following tags are included in the inline tag group: Inline Tags: emphasis; code; term; cite; cnxn; link; foreign; quote. Unicode text can also be included inline.

Note:

Inline tags can only contain other inline tags.

emphasis

Description

The emphasis tag is used to emphasize text in a CNXML document where emphasis would be needed or desired. It is important to note that this refers to semantic emphasis and not a typeface, although many stylesheets may choose to render it as a change in typeface.

Attributes

None

Type

Inline

Contained Within:

Children

See inline tags.

Example 8

	  
	<para id="emphexample">
	  In addition to bananas and ice cream, a proper banana split
	  requires whipped cream, nuts, <emphasis>and</emphasis>
	  cherries.  Remember that the quality of the dessert depends
	  on the ice cream, so do <emphasis>not</emphasis> use a
	  generic brand.
	</para>
	  
	

In addition to bananas and ice cream, a proper banana split requires whipped cream, nuts, and cherries. Remember that the quality of the dessert depends on the ice cream, so do not use a generic brand.

quote

Description

The quote is used to create block quotes.

Note:
Inline quotes can be written out by hand. i.e. "The man in the blue coat is a police officer".

Attributes

  • src - an optional relative or absolute URI indicating the path to the quote's src.
  • type - the type of quote
    • block - creates a block quote which is separate from the flow of text
    • inline - creates an inline quote

Type

inline

Contained Within:

Children

Quote may take a combination of inline tags.

Example 9

	  
	<para id="quoteexample">
	  <quote src='http://www.artofeurope.com/shakespeare/sha8.htm'> 
	  To be, or not to be: that is the question: Whether 'tis nobler
	  in the mind to suffer The slings and arrows of outrageous
	  fortune, Or to take arms against a sea of troubles, And by
	  opposing end them?</quote>
	</para>
	  
	

To be, or not to be: that is the question: Whether 'tis nobler in the mind to suffer The slings and arrows of outrageous fortune, Or to take arms against a sea of troubles, And by opposing end them? [source]

foreign

Description

The foreign tag is used to denote that a tag is a foreign word or phrase.

Attributes

  • Optional: src - a relative or absolute URI indicating the path to the foreign word or phrases' src.

Type

Inline

Contained Within:

Children

See inline tags.

Example 10

	  
	<para id="foreignexample">In spanish speaking countries
	  you may often hear people say <foreign>Hola
	  Amigo</foreign>, which means 'hello friend'.
	</para>
	  
	

In spanish speaking countries you may often hear people say Hola Amigo, which means 'hello friend'.

code

Description

The code tag is used to insert a line or block of computer code (for example a command) into a document. When displayed, it will often be typeset in a fixed-width font.

Attributes

  • type
    • inline - the code will be included in the current line of text.
    • block- the code will be set apart from the text and indented.
  • id (unique and optional)

Type

Special

Contained Within:

Children

Code can contain a combination of inline tags.

Example 11

	  Enter the command <code>ls /etc</code> to
	  get a listing of configuration files.
	

Enter the command ls /etc to get a listing of configuration files.

CNXN

Description

The cnxn tag links to a Connexions system document or a tag inside a Connexions system document, possibly different from the current document.

Attributes

  • document - the id of the document linked to
    • Optional
    • CDATA
    • If the document attribute is omitted, the link will default to the current document.
  • target - the id of the tag being linked to
    • Optional
    • CDATA
    • If the target attribute is omitted, the link will default to the root element of the target document.
  • version - the version of the document being liked to
    • Optional
    • CDATA
    • If the version attribute is omitted, the link will default to the current version of the document.
  • strength - the strength of the association to what is being discussed
    • Optional
    • Deprecated
    • The value must be a number (1-9)

Type

Inline

Contained Within:

Children

The cnxn tag may contain one or more inline tags.

Example 12

	  
	<cnxn document="m7473" target="figure12">Resistance Figure</cnxn>
	<cnxn target="para32">As mentioned earlier</cnxn>
	<cnxn document="m3423">A previous document</cnxn>
	

cite

Description

The cite tag is used to refer to non-electronic materials (ones without a hypertext link). It typically will contain the title of the work.

Attributes

  • src
    • optional
    • A relative or absolute URI indicating the path to the object. May also contain the id of a bibtex reference. This is still required to be a URI and thus must be designated using # when referring to an id in a connexions module. <cite src="#white1998">White, 1998</cite>

Type

Inline

Contained Within:

Children

Cite may contain one or more inline tags.

Example 14

	  
    <para id="citeexample">
      <cite>A Tale of Two Cities</cite> is a classic novel by Mark Twain.
    </para> 
	

A Tale of Two Cities is a classic novel by Mark Twain.

term

Description

The term tag marks the word or phrase being defined. It can be used in either a definition tag or in a sentence in a para.

Attributes

  • src - a relative or absolute URI indicating the path to the object. May also contain the id of a glossary reference that must be identified as a URI using # before the id. <term src="#square">square</term>

Type

inline

Contained Within:

Children

Term may contain one or more inline tags.

Example 15

	  
	<para id='parterm2'>
	  A <term>square</term> is a rectangle with equal sides.
	</para>
	  
	

This might be displayed as in the next paragraph.

A square is a rectangle with equal sides.

See also definition examples.

Special Tags

The following tags are considered to be 'special' because the content model for each of them is very specific: Special Tags: para; definition; rule; figure; subfigure; caption; media; table; name; list; item; exercise; equation; note; glossary; seealso. Special tags are tags which adhere to one or more of the following:

  1. Can only contain certain children.
  2. Can contain no children.
  3. Can only appear as a child of another tag.

Note:

Each of these special tags will be defined and explained later in the specification.

document

Description

The document tag is the root document element of CNXML documents, commonly called "modules."

Attributes

  • id - A unique document identifier
    • Required
    • ID

Type

Structural

Contained Within:

none

Children

  • The first child of the document tag must always be name, which is the name of the document.
  • The second child of the document tag will usually be metadata, which contains all the metadata of the document.
  • The third child of the document tag must always be content, which contains the content (e.g., section or para) of the document.
  • The fourth child of the document tag is the optional glossary tag.
  • The fifth child of the document tag is the optional bib:file tag.

Example 16: Examples

	  
        <document id="spec">
	  <name>CNXML 0.5 Language Specification</name>
	  <metadata>
	    .
	    .
	    .
	  </metadata>
	  <content>
	    .
	    .
	    .
	  </content>
	  <glossary>
	    .
	    .
	    .
	  </glossary>
	  <bib:file>
	    .
	    .
	    .
	  </bib:file>
	</document>
	  

metadata

Description

The metadata tag is where all the metadata tags and information is placed. In cnxml 0.5 the metadata namespace must be included in the document tag as an attribute, and all metadata tags must begin with the prefix md:. For more information on how to include the namespace in the document tag see the Basic Cnxml. Information on the tags listed as children for the metadata tag can be found in the Editing Metadata section of the CNXML tutorial.

Attributes

None

Type

Special

Contained Within:

Children

  • The first child of the metadata tag must always be a version tag.
  • The second child of the metadata tag must always be a created tag.
  • The third child of the metadata tag must always be a revised tag.
  • The fourth child of the metadata tag must always be an authorlist tag.
  • The fifth child of the metadata tag must always be a maintainerlist tag.
  • The keywordlist tag may appear next, if it appears at all.
  • The abstract tag must appear next.
  • An objectives tag may appear after that, if it appears at all.

Example 17

	  
	<metadata>
	  <md:version>2.1</md:version>
	  <md:created>01-12-06</md:created>
	  <md:revised>01-12-07</md:revised>	

	  <md:authorlist>
	    <md:author id="selc">
	      <md:firstname>Sarah</md:firstname>
	      <md:surname>Coppin</md:surname>
	    </md:author>
	    <md:author id="bmh">
	      <md:firstname>Brent</md:firstname>
	      <md:surname>Hendricks</md:surname>
	    </md:author>
	    <md:author id="drewlin">
	      <md:firstname>Andrew</md:firstname>
	      <md:surname>Lin</md:surname>
	    </md:author>
	    <md:author id="rars">
	      <md:firstname>Ricky</md:firstname>
	      <md:surname>Radaelli-Sanchez</md:surname>
	    </md:author>
	  </md:authorlist>
	  <md:maintainerlist>
	    <md:maintainer id="selc">
	      <md:firstname>Sarah</md:firstname>
	      <md:surname>Coppin</md:surname>
	    </md:maintainer>
	    <md:maintainer id="bmh">
	      <md:firstname>Brent</md:firstname>
	      <md:surname>Hendricks</md:surname>
	    </md:maintainer>
	    <md:maintainer id="rars">
	      <md:firstname>Ricky</md:firstname>
	      <md:surname>Radaelli-Sanchez</md:surname>
	    </md:maintainer>
	  </md:maintainerlist>
	  <md:keywordlist>
	    <md:keyword>CNXML</md:keyword>
	    <md:keyword>MathML</md:keyword>
	    <md:keyword>XML</md:keyword>
	    <md:keyword>specification</md:keyword>
	  </md:keywordlist>
	  <md:abstract>
	    CNXML 0.3 Language Specification
	  </md:abstract>
	  <md:objectives>
	    Explain in detail how the CNXML language should be used.
	  </md:objectives>
	</metadata>
	  
	

content

Description

The content tag is where the content information of a document is stored.

Attributes

None

Type

Structural

Contained Within:

Children

See Structural Tags.

Example 18

	  
	<content>
	  <section id="version">
	    <name>Document History</name>
	    <list id="p1">
	      <item>
	        Release 0.1 -- Pre release.
	      </item>
	    </list>	
	  </section>
	    .
	    .
	    .
	</content>
	  
	

para

Description

The para tag contains a paragraph of possibly marked-up text.

Attributes

  • id - unique id
    • Required
    • ID

Type

Para

Contained Within:

  • Structural Tags

Children

inline tags

Example 19

Two paragraphs from War and Peace.


	        
	<para id="para1">
	  Prince Andrei was on duty that day and in constant attendance
          on the Commander in Chief.
	</para>
	<para id="para2">
	  At six o'clock in the evening Kutuzov went to the Emperor's
	  headquarters, and after remaining but a short time with him, 
	  went to the Grand Marshal of the Court, Count Tolstoy.  
	</para>
	  
	

name

Description

The name tag provides a searchable name for a particular object such as a document, section or a figure.

Attributes

None

Type

Special

Contained Within:

Children

Unicode text representing an object's name

Example 20

	  
	<section id="intro">
	  <name>An Introduction to CNXML</name>
	  .
	  .
	  .
	</section> 
	

definition

Description

The definition tag is used to define a word or a term.

Attributes

  • id - unique id
    • Required
    • ID

Type

Special

Contained Within:

Children

  • The definition tag can contain only three types of tags: term, meaning, and example.
  • The term tag is always required and is first.
  • After that, at least one meaning tag is required. Multiple meaning tags are allowed in a definition.
  • Next, after each meaning tag you may put 0, 1, or many example tags. examples should follow the meaning they relate to.
  • Finally, you may have an optional seealso tag.

Example 21

	  
	<definition id='quardef'>
	  <term>quarter</term>
	  <meaning>One fourth of something.</meaning>
	  <example id='defex1'>
	    <para id='parex1'>
	    "He cut the pie into quarters and gave all four people a
	    piece."
	    </para>
	  </example>
	  <meaning>25 cents, a quarter of a dollar.</meaning>
	  <example id='defex2'>
	    <para id='parex2'>
	      "The drink cost a quarter."
	    </para>
	  </example>
	  <example id='defex3'>
	    <para id='parex3'>
	      "She picked up a roll of quarters so that she could do
	      laundry."
	    </para>
	  </example>
	  <seealso><term>dollar</term><term>penny</term></seealso>
	</definition>
	  
	
Definition 1: quarter
1. One fourth of something.
Example

"He cut the pie into quarters and gave all four people a piece."

2. 25 cents, a quarter of a dollar.
Example

"The drink cost a quarter."

Example

"She picked up a roll of quarters so that she could do laundry."

See Also: dollar, penny

meaning

Description

The meaning tag gives one definition of the word or phrase being defined in a definition. Each definition tag can have multiple meanings and therefore multiple meaning tags.

Attributes

None

Type

structural

Contained Within:

Children

Meaning can contain a combination of inline tags, and special tags.

Examples

See the definition examples.

glossary

Description

The glossary tag is where definitions that can be placed if the author does not wish to place them in the flow of text. For more information see CNXML Reference Extensions.

Attributes

  • id (optional)

Type

Special

Contained Within:

Children

One or more definition tags.

Example 22

	  
	<glossary id='glossary1'>
	  <definition id='quardef'>
	    <term>quarter</term>
	    <meaning>
              <name>Meaning Name</name>
              One fourth of something.
            </meaning>
	    <example id='def'>
	      <para id='par'>
	        "He cut the pie into quarters and gave all four people a
	        piece."
	      </para>
	    </example>
	    <meaning>25 cents, a quarter of a dollar.</meaning>
	    <example id='def2'>
	      <para id='par2'>
	        "The drink cost a quarter."
	      </para>
	    </example>
	    <example id='def3'>
	      <para id='par3'>
	        "She picked up a roll of quarters so that she could do
	        laundry."
	      </para>
	    </example>
	  </definition>
	</glossary>
	

seealso

Description

The seealso tag is a list of terms that the author believes would be beneficial to the person reviewing the document. Each definition tag can contain one see also tag.

Attributes

None

Type

special

Contained Within:

Children

Seealso can contain one or more term tags.

Examples

See the definition examples.

note

Description

The note tag is used to add a note about text in a CNXML document.

Aside:
Note tags can add more information to a text which is unimportant to the immediate text itself.

Attributes

  • type - the type of note
    • Optional
    • CDATA
      Note:
      The value of type is left open to the author. The author can choose different values that reflect the purpose of the note. Some suggestions are: note, aside, point of interest, warning, etc.

Type

Special

Contained Within:

Children

Note can take a combination of inline tags.

Example 23

	  
	<para id="noteexample">
	  Chemistry lab was always a lot of fun. We played with a lot
	  of chemicals such as Sulfuric and Hydrochloric acid. <note
	  type="warning">Sulfuric and Hydrochloric Acid are very
	  dangerous. Please handle with caution.</note>
	</para>
	  
	

Chemistry lab was always a lot of fun. We played with a lot of chemicals such as Sulfuric and Hydrochloric acid.

Warning:
Sulfuric and Hydrochloric Acid are very dangerous. Please handle with caution

rule

Description

The rule tag defines any type of "rule" such as theorems, axiom, lemmas, rule of thumb, etc. This tag is especially useful for mathematical texts.

Attributes

  • id - a unique identifier
    • Required
    • ID
  • type - the kind of rule: theorem, axiom, lemma, etc.
    • Required
    • CDATA
      Note:
      The values are not explicitly defined by this specification, because it would be unfeasible to create an exhaustive list. However, some suggestions are theorem, axiom, lemma, corollary, proposition.

Type

special

Contained Within:

  • Structural Tags
  • para

Children

First, rule may contain an optional name tag. Next, it must contain one or more statement tags. Finally, rule may contain zero or more proof tags and zero or more example tags in any order.

Example 24

	  
	<rule type='theorem' id='ruleexcode'>
	  <name>Pythagorean Theorem</name>
	  <statement>
	    <para id='ruleexp1'>
	      On a right triangle, the sum of the squares of the
	      sides equals the square of the hypotenuse.
	    </para>
	  </statement>
	  <proof>
	    <para id='ruleexp2'>
	      Your favorite proof goes here.
	    </para>
	  </proof>
	  <example>
	    <para id='ruleexp3'>
	      Take a right triangle whose sides are of length 3, 4,
              and 5.  In this case the sum of the square of the two 
              shorter sides is 9+16=25.  The square of the hypotenuse 
              is 25.  So the theorem holds.
	    </para>
	  </example id='pythexamp1'>
	  <proof>
	    <para id='ruleexp4'>
	      Another proof could go here.
	    </para>
	  </proof>
	  <example id='pythexamp2'>
	    <para id='ruleexp5'>
	      Another example could go here.
	    </para>
	  </example>
	</rule> 
	
Theorem 1: Pythagorean Theorem

On a right triangle, the sum of the squares of the sides equals the square of the hypotenuse.

Proof

Your favorite proof goes here.

Example

Take a right triangle whose sides are of length 3, 4, and 5. In this case the sum of the square of the two shorter sides is 9+16=25. The square of the hypotenuse is 25. So the theorem holds.

Proof

Another proof could go here.

Example

Another example could go here.

Lists and Figures

These are the tags specific to adding lists and figures to the document.

list
Description

The list tag is used to create ordered or unordered lists of items.

Attributes

  • id - unique id
    • Required
    • ID
  • type - makes the list ordered or unordered
    • Optional
    • Possible values
      • enumerated - numbers the list with the first item after the tag being the first element
      • bulleted - creates a bulleted list of items
      • inline - creates an inline list
      • named-item - creates a list in which each item must be named
    • Default is bulleted.

Type

Special

Contained Within:

Children

The list tag may contain an optional name tag followed by one or more item tags.

Example 25: Enumerated List Example

	    
	  <list id="grocerylist" type="enumerated">
	    <name>Grocery List</name>
	    <item>Milk</item> 
	    <item>Eggs</item> 
	    <item>Sugar</item>
	  </list> 
	  
Grocery List
  1. Milk
  2. Eggs
  3. Sugar
item
Description

The item tag is used to specify an item of a list. It appears only as the child of list tags.

Attributes

  • id - unique id
    • Optional
    • ID

Type

Special

Contained Within:

Children

The item tag may contain an optional name tag followed by one or more inline tags.

Example 26

	    
          <list id='forces'>
	    <name>Four fundamental forces</name>
	    <item>Electromagnetism</item> 
	    <item>Gravity</item> 
	    <item>Strong nuclear force</item>
	    <item>Weak nuclear force</item>
	  </list>
	  
Four fundamental forces
  • Electromagnetism
  • Gravity
  • Strong nuclear force
  • Weak nuclear force
figure
Description

The figure tag provides the structure for creating a figure within a document. A figure could contain such things as an image, or a table, or several of these.

Attributes

  • id - unique id
    • Required
    • ID
  • orient - allows the writer to determine which way subfigures should be arranged (irrelevant if there are no subfigures)
    • Optional
    • Possible values
      • horizontal - subfigures will be placed next to each other
      • vertical - subfigures will be placed on top of each other
    • Default is horizontal.

Type

Special

Contained Within:

Children

Example 27

	    
	  <figure id="fig1">
	    <name>A Happy Dog</name>
	    <media type="image/jpg" src="image1.jpg"/>
	    <caption>The dog displayed in this picture is enjoying a
	    comfortable bed.</caption>
	  </figure>
	    
	  
Figure 1: The dog displayed in this picture is enjoying a comfortable bed.
A Happy Dog
A Happy Dog (spec/image1.jpg)
subfigure
Description

The subfigure tag is used when you want to use more than one media tag or table tag, etc. inside of the same figure tag. It is only appropriate to use subfigures if the subfigures are related in some way. The usage of the subfigure tag is similar to that of figure, except that it cannot contain another subfigure tag.

Attributes

  • id - unique id
    • Optional
    • ID

Type

Special

Contained Within:

Children

Example 28

Here are two subfigures appearing in a figure whose orient attribute is set to "horizontal".


	    
	  <figure orient="horizontal" id="horfig">
	    <subfigure id="subfig1">
	      <media type="image/jpg" src="image1.jpg"/>
	    </subfigure>
	    <subfigure id="subfig2">
	      <media type="image/jpg" src="image2.jpg"/>
	    </subfigure>
	  </figure>
	    
	  
Figure 2
(a) (b)
Figure 2(a) (spec/image1.jpg)Figure 2(b) (spec/image2.jpg)

Similarly, here are two subfigures appearing in a figure whose orient attribute is set to "vertical".


	    
	  <figure orient="vertical" id="vertfig">
	    <subfigure id="subfig3">
	      <media type="image/jpg" src="image1.jpg"/>
	      <caption>Dog sitting</caption>
	    </subfigure>
	    <subfigure id="subfig4">
	      <media type="image/jpg" src="image2.jpg"/>
	      <caption>Dog standing</caption>
	    </subfigure>
	  </figure> 
	  
Figure 3
(a) Dog sitting
Figure 3(a) (spec/image1.jpg)
(b) Dog standing
Figure 3(b) (spec/image2.jpg)
caption
Description

The caption tag is only used to provide a caption for a figure or a subfigure. The caption tag is distinct from the name tag in that it provides a possibly lengthy description of the figure for the reader's use and not an overall title or name.

Attributes

None

Type

Special

Contained Within:

Children

Caption may contain one or more inline tags.

Example 29

In this example, notice the different roles played by the name tag and the caption tag.


	    
	  <figure id="fig3">
	    <name>A Happy Dog</name>
	    <media type="image/jpg" src="image1.jpg"/>
	    <caption>The dog displayed in this picture is enjoying a
	    comfortable bed.</caption>
	  </figure> 
	  
Figure 4: The dog displayed in this picture is enjoying a comfortable bed.
A Happy Dog
A Happy Dog (spec/image1.jpg)

media

Description

The media tag inserts "media objects", such as images, applets, movies, sounds, or any valid mimetype, into CNXML documents.

Attributes

  • type - the MIME type of the media object.
    • Required
    • CDATA
      Note:
      Some examples of MIME types for common objects include image/png, audio/basic, video/quicktime, and application/x-java-applet.
  • src - a relative or absolute URI indicating the path to the object.

Type

Special

Contained Within:

Children

The media tag may take one or more param tags, followed by one or more media tags.

Example 30

	  
        <media type="application/postscript" src="image1.eps">
	  <param name='height' value='300'/>
	  <param name='width'  value='200'/>
          <media type='image/png' src='image2.png'/>
	</media>
	

The example code illustrates the use of nested media tags. The outer image tag specifies the preferred (default) image. If the browser does not support that particular file type, the child media tag will be used instead.

Example 31

          
        <media type="application/x-java-applet" src="applet.class">
          <param name='height' value='300'/>
          <param name='width'  value='200'/>
          <media type='image/png' src='image2.png'/>
        </media>
        

param

Description

The param tag allows you to pass parameters to the media tag.

Attributes

  • name - the attribute name of the parameter.
    • Required
    • CDATA
      Note:
      Some examples of param types for common objects include height, width
  • value - the value for the parameter

Type

Special

Contained Within:

  • media

Children

none (EMPTY)

Example 32

	  
	<media type="image/jpg" src="image1.jpg">
	  <param name='height' value='300'/>
	  <param name='width'  value='200'/>
	</media>
	

equation

Description

The equation tag is used to set off equations in CNXML documents by using unicode text and embedded media to display math.

note:
It is strongly encouraged, however, to use equation with Content MathML tags when displaying math.

Attributes

  • id - unique id
    • Required
    • ID

Type

Special

Contained Within:

Children

The equation tag may optionally have name as the first child, to associate a name with the equation. The equation tag must contain any number of media tags, or mathml.

Note:
For maximum flexibility,any math contained in the equation tag should be marked up using Content MathML tags.

Example 33

	  
	<equation id="eqn14">
	  <name>Euler's Relation</name>
	  <media type='image/gif' src='euler.gif' />
	</equation>
	

	  
	<equation id='eqn15'>
	  <name>Simple Arithmetic</name>
	  11+27=38
	</equation>
	
Euler's Relation
spec/euler.gif (1)
Simple Arithmetic
11+27=38 (2)

CALS Table Model

CNXML uses the 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; a second example). For a more complete description of the CALS Table consult the CALS Table Spec.

table

Description

The table tag marks beginning of a table.

Attributes

  • id-a unique id (added for CNXML)
    • Required
    • ID
  • frame-position of lines drawn around table
    • Optional
    • Possible Values
      • sides-left and right
      • top-below title
      • bottom-after last row
      • topbot-top and bottom
      • all-all of the above
      • none
    • Default comes from tabstyle, otherwise it is "all"
  • colsep-sets whether the internal column rulings are displayed or not
    • Optional
    • CDATA
    • Possible Value
      • 0-do not display column rulings
      • any other number-display column rulings
    • Default comes from tabstyle if used, otherwise it is 1.
  • rowsep-sets whether the internal row rulings are displayed or not
    • Optional
    • CDATA
    • Possible Value
      • 0-do not display column rulings
      • any other number-display column rulings
    • Default comes from tabstyle if used, otherwise it is 1.
  • tabstyle-an identifier for a table style
  • tocentry-says whether the table's title, if it exists, is listed in the table of contents
    • Optional
    • CDATA
    • Possible Value
      • 0-do not include in table of contents
      • any other number-display in table of contents
    • Default comes from style specification if it exists, otherwise it is 1
    • shortentry-says whether to use the shorttitle, or title if no shorttitle exists, in listings in other parts of the document
      • Optional
      • CDATA
      • Default comes from style specification if it exists, otherwise it is "0"
    • orient-orientation of table
      • Optional
      • Possible Values
        • port
        • land
      • Default comes from style specification if it exists, otherwise it is "port"
    • pgwide-determines the available width of the table (only used when orient='pgwide')
      • Optional
      • CDATA
      • Possible Values
        • 0-maximum width of the table is the galley width
        • any other number-the width of the table is the entire width of the page
      • Default comes from the style specification, otherwise it depends on the medium.

Children

Example 34

	  
	<table frame="all" id="budgettable1">
	  <name>Budget - Comparison by year</name>
	  <tgroup cols="4" align="left" colsep="1" rowsep="1">
	    <colspec colnum="2" colname="c2"/>
	    <colspec colnum="4" colname="c4"/>
	    <thead valign="top">
	      <row>
	        <entry morerows="1" align="center">Item</entry>
	        <entry namest="c2" nameend="c4" align="center">Year</entry>
	      </row>
	      <row>
	        <entry align="center">1998</entry>
	        <entry align="center">1999</entry>
	        <entry align="center">2000</entry>
	      </row>
	    </thead>
	    <tbody valign="top">
	      <row>
	        <entry>Income</entry>
	        <entry>12,293</entry>
	        <entry>12,398</entry>
	        <entry>14,298</entry>
	      </row>
	      <row>
	        <entry>Expenditure</entry>
	        <entry>293</entry>
	        <entry>398</entry>
	        <entry>298</entry>
	      </row>
	      <row>
	        <entry>Surplus</entry>
	        <entry>12000</entry>
	        <entry>12000</entry>
	        <entry>14000</entry>
	      </row>
	    </tbody>
	  </tgroup>
	</table>
	  
	
Table 1: Budget - Comparison by year
Item Year
1998 1999 2000
Income 12,293 12,398 14,298
Expenditure 293 398 298
Surplus 12000 12000 14000
tgroup
Description

The tgroup tag identifies a new portion of a table.

Attributes

  • cols-number of columns in the tgroup
    • CDATA
    • Possible Values
      • a number-the number of columns in the group
  • tgroupstyle-a name of a style
  • colsep-sets whether the internal column rulings are displayed or not
    • Optional
    • CDATA
    • Possible Value
      • 0-do not display column rulings
      • any other number-display column rulings
    • Default is the value from tgroupstyle if it exists, or from table if it exists, otherwise it is 1
  • rowsep-sets whether the internal row rulings are displayed or not
    • Optional
    • CDATA
    • Possible Value
      • 0-do not display column rulings
      • any other number-display column rulings
    • Default is the value from tgroupstyle if it exists, or from table if it exists, otherwise it is 1
  • align-how the text will be aligned
    • Optional
    • Possible Values
      • left-left justified
      • right-right justified
      • center-centered
      • justify-right and left justified
      • char-aligns to the leftmost occurance of the value of the char attribute
    • Default uses value from tgroupstyle if it exists, otherwise use left
  • char-the character used in align
    • Optional
    • CDATA
    • Default uses value from tgroupstyle if it exists, otherwise use ""
  • charoff-the precentage of the column width to the left of the char used in align
    • Optional
    • CDATA
    • Default uses value from tgroupstyle if it exists, otherwise it is "50"

Children

Example

See the table example.

colspec
Description

The colspec tag specifies a column of a table or entrytbl.

Attributes

  • colnum-number of the column
    • Optional
    • CDATA
    • Possible Value
      • a number
  • colname-name of the column (used by entry and entrytbl)
  • colwidth-the width of the column
    • Optional
    • CDATA
    • Possible Values
      • a proportional measure (i.e. number*)-5* means five times the proportion
      • a fixed measure (i.e. a number followed by units)-3pt means 3 point
      • a mixed measure-5*+3pt means fives the proportion plus 3 point
      • Default comes from a named style specification (if it exists). If the style specification does not exist or if it is "", then colwidth='1*'
    • colsep-sets whether the internal column rulings are displayed or not
      • Optional
      • CDATA
      • Possible Value
        • 0-do not display column rulings
        • any other number-display column rulings
      • Default comes from nearest spanspec or tgroup
    • rowsep-sets whether the internal row rulings are displayed or not
      • Optional
      • CDATA
      • Possible Value
        • 0-do not display column rulings
        • any other number-display column rulings
      • Default comes from nearest spanspec or tgroup
    • align-how the text will be aligned
      • Optional
      • Possible Values
        • left-left justified
        • right-right justified
        • center-centered
        • justify-right and left justified
        • char-aligns to the leftmost occurance of the value of the char attribute
      • Default comes from tgroup, its tgroupstyle, otherwise it is "left".
    • char-the character used in align
    • charoff-the precentage of the column width to the left of the char used in align

Children

EMPTY

Example

See the table example.

spanspec

Description

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

Attributes

  • namest-name of the furthest left column in a span
  • nameend-name of the furthest right column in a span
  • spanname-name for the horizontal span (used by entry and entrytbl)
  • colsep-sets whether the internal column rulings are displayed or not
    • Optional
    • CDATA
    • Possible Value
      • 0-do not display column rulings
      • any other number-display column rulings
    • Default comes from namest column's colspec
  • rowsep-sets whether the internal row rulings are displayed or not
    • Optional
    • CDATA
    • Possible Value
      • 0-do not display column rulings
      • any other number-display column rulings
    • Default comes from namest's colspec
  • align-how the text will be aligned
    • Optional
      • left-left justified
      • right-right justified
      • center-centered
      • justify-right and left justified
      • char-aligns to the leftmost occurance of the value of the char attribute
    • Default uses tgroupstyle if it exists, otherwise it is "center"
  • char-the character used in align
  • charoff-the precentage of the column width to the left of the char used in align

Children

EMPTY

Example

See the table example.

thead

Description

The thead tag identifies the heading row of a tgroup or entrytbl.

Attributes

  • valign-vertical position of the text
    • Optional
    • Possible Values
      • top
      • middle
      • bottom
  • Default is "bottom"

Children

Example

See the table example.

tfoot

Description

The tfoot tag identifies the rows of footer information that are displayed after the tbody.

Attributes

  • valign-vertical position of the text
    • Optional
    • Possible Values
      • top
      • middle
      • bottom
  • Default is "top"

Children

Example

See the table example.

tbody

Description

The tbody tag identifies the body of a tgroup or entrytbl.

Attributes

  • valign-vertical position of the text
    • Optional
    • Possible Values
      • top
      • middle
      • bottom
  • Default is "top"

Children

  • one or more row

Example

See the table example.

row

Description

The row tag identifies the row of information in a thead, tbody, or tfoot.

Attributes

  • rowsep-sets whether the internal row rulings are displayed or not
  • valign-vertical alignment of the text
    • Optional
    • Possible Values
      • top
      • middle
      • bottom
    • Default is "top"

Children

Example

See the table example.

entrytbl

Description

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.

Attributes

  • cols-number of columns in the entrytbl
    • Required
    • CDATA
    • Possible Values
      • a number-the number of columns
  • tgroupstyle-a name of a style
  • colname-colname of a colspec in the containing tgroup
  • spanname-name of horizontal span named in a spanname of a spanspec
  • namest-name of the furthest left column in a span
  • nameend-name of the furthest right column in a span
  • colsep-sets whether the internal column rulings are displayed or not
    • Optional
    • CDATA
    • Possible Value
      • 0-do not display column rulings
      • any other number-display column rulings
    • Default comes from tgroup
  • rowsep-sets whether the internal row rulings are displayed or not
    • Optional
    • CDATA
    • Possible Value
      • 0-do not display column rulings
      • any other number-display column rulings
    • Default comes from row if it exists, otherwise spanspec or colspec, and if not that then tgroup, and then finally table
  • align-how the text will be aligned
    • Optional
    • Possible Values
      • left-left justified
      • right-right justified
      • center-centered
      • justify-right and left justified
      • char-aligns to the leftmost occurance of the value of the char attribute
    • Default comes from tgroupstyle, if it exists, otherwise from a containing spanspec or colspec, or tgroup or tgroupstyle, if they exist. If none of the others apply, use "left".
  • char-the character used in align
    • Optional
    • CDATA
    • Default is no aligning character.
  • charoff-the precentage of the column width to the left of the char used in align

Children

Example

See the table example.

entry

Description

The entry tag identifies a entry in a row.

Attributes

  • colname-name of the column so that entry and entrytbl can span columns
  • namest-name of the furthest left column in a span
  • nameend-name of the furthest right column in a span
  • spanname-name of a horizontal span
  • morerows-how many more rows are in a rowspan
    • Optional
    • CDATA
    • Possible Values
      • a number-the number of rows in the span after the current one
    • Default is 0
  • colsep-sets whether the internal column rulings are displayed or not
    • Optional
    • CDATA
    • Possible Value
      • 0-do not display column rulings
      • any other number-display column rulings
    • Default comes from colspec or spanspec
  • rowsep-sets whether the internal row rulings are displayed or not
    • Optional
    • CDATA
    • Possible Value
      • 0-do not display column rulings
      • any other number-display column rulings
    • Default comes from nearest ancestor with rowsep attribute defined.
  • align-how the text will be aligned
    • Optional
    • Possible Values
      • left-left justified
      • right-right justified
      • center-centered
      • justify-right and left justified
      • char-aligns to the leftmost occurance of the value of the char attribute
      • Default comes from closest spanspec or colspec of the closest containing entrytbl or tgroup of one of their tgroupstyle. If none of these exist, then use "left".
  • char-the character used in align
    • Optional
    • CDATA
    • Default is no aligning character. However if there is a lack of the attribute all together then the default comes from closest container with a char value.
  • charoff-the precentage of the column width to the left of the char used in align
  • rotate-sets the orientation of the content to be the same as the table or 90 degrees counterclockwise from the table.
    • Optional
    • CDATA
    • Possible Values
      • 0-content is orientation the same direction as the table
      • 1-content is orientation 90 degrees counterclockwise from the table
    • Default is 0
  • valign-vertical position of the text
    • Optional
    • Possible Values
      • top
      • middle
      • bottom
    • Default comes from nearest ancestor that defines valign.

Children

The entry tag contains any number of inline tags and media.

Example

See the table example.

Using CNXML

Validity

To aid in testing conformance with this specification, we provide implementations in various schema formats below. In some cases, however, the schema language is not expressive enough to capture the full specification. In these cases we have chosen to allow the schema implementation to be more lax. In other words, any document conforming to the specification will validate according to the schema, but not necessarily vice versa. In all cases, consider this specification to be the definitive reference for CNXML, taking precedence over any provided schema. In other words, by definition the spec is always right.

  • DTD - A zipfile containing the Document Type Definition files for CNXML. To use this, add the following to the top of your file, before <document>
    
    		<!DOCTYPE document PUBLIC "-//CNX//DTD CNXML 0.5//EN" 
    		     "http://cnx.rice.edu/cnxml/0.5/DTD/cnxml_plain.dtd">
    	      
  • XSD - With CNXML 0.5, we are now making a schema available in the W3C's XML Schema format. To use XML schema, add these attributes to the document tag:
    
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://cnx.rice.edu/cnxml http://cnx.rice.edu/cnxml/0.5/schema/cnxml.xsd" 
    	      
  • Coming soon: RelaxNG

Using CNXML with other XML languages

CNXML does not encompass all possible markup that someone might wish to include in a document. Rather, it is intended to serve as a general-purpose framework for marking the structure and semantics of the material. For more specific markup in a particular area, you can can combine CNXML with other XML markup languages. A common example is the use of MathML to mark up mathematical equations (see below).

Namespaces

Since the same tag may be used to mean different things in different XML languages, each language defines a URI to act as a namespace, distinguishing it from other languages. The combination of namespace URI and tag name is globally unique. The CNXML namespace is: http://cnx.rice.edu/cnxml. For more information on how to use namespaces, see the W3C's Namespaces in XML specification.

Note:
Usually, there are no restrictions on which namespace (if any) should be the default or on what the namespace prefix should be. However, if you are using the DTD provided above, CNXML must be used as the default namespace with no prefix.

CNXML and MathML

The combination of CNXML and MathML occurs commonly since much educational material has mathematical content. To aid in this, we have included a special DTD in the DTD archive above that allows you to validate combined CNXML/MathML files. To take advantage of this, do the following three things:

  • Add the following Document Type Definition to the top of your file before <document>
    
    		<!DOCTYPE document PUBLIC "-//CNX//DTD CNXML 0.5 plus MathML//EN" 
    		     "http://cnx.rice.edu/cnxml/0.5/DTD/cnxml_mathml.dtd">
    	      
  • Declare the MathML namespace, xmlns:m="http://www.w3.org/1998/Math/MathML" on <document>
  • Prepend the MathML prefix m: to every MathML tag in your document

Places MathML is allowed

Formal equations and relations should be wrapped in the CNXML equation tag. These may be given names and are easy to search for. Additionally, some presentations of CNXML may provide automatic numbering for equations. In addition to formal equations, you may include math in any CNXML tag that allows inline tags.

Note:
You must enclose all mathematics in the <m:math> tag.

Example

A short CNXML/MathML is listed below. Note the DOCTYPE declaration at the top, the xmlns and xmlns:m attributes on the document tag, and the use of the m: prefix on MathML tags.


<?xml version="1.0" standalone="no"?>
<!DOCTYPE document PUBLIC "-//CNX//DTD CNXML 0.5 plus MathML//EN" 
	  "http://cnx.rice.edu/cnxml/0.5/DTD/cnxml_mathml.dtd">
<document xmlns="http://cnx.rice.edu/cnxml"
	  xmlns:m="http://www.w3.org/1998/Math/MathML"
	  id='mathml'>
  <name>Combining MathML and CNXML</name>
  <content>
    <para id="p1">
      This is a small piece of math written using MathML:
      <m:math>
	<m:apply>
	  <m:plus/>
	  <m:cn>2</m:cn>
	  <m:cn>3</m:cn>
	</m:apply>
      </m:math>
    </para>
  </content>
</document>
	    

For more information on combining CNXML and MathML (including many examples), see the Connexions module Content MathML.