Skip to content Skip to navigation

Connexions

You are here: Home » Content » Using Basic CNXML in Edit-In-Place

Navigation

Recently Viewed

This feature requires Javascript to be enabled.

Tags

(What is a tag?)

These tags come from the endorsement, affiliation, and other lenses that include this content.
 

Using Basic CNXML in Edit-In-Place

Module by: Elizabeth Gregory. E-mail the author

Based on: The Basic CNXML by Ricardo Radaelli-Sanchez, Brent Hendricks

Summary: This document introduces simple CNXML tags that are easy to use in Edit-in-Place.

Note: You are viewing an old version of this document. The latest version is available here.

Please Note:

This module also contains information derived from The Advanced CNXML by Ricardo Radaelli-Sanchez.

Starting with CNXML

To create the bare bones of content in Connexions, the author interface provides a variety of creation tools: the Document Importer, Edit-In-Place, and even a full-source editor. However, a basic knowledge of our markup language can help make small edits into tremendous enhancements to your material!

The Connexions Project uses the Connexions Markup Language (CNXML) as its primary language for marking up and storing documents. CNXML is lightweight XML for marking up educational content. Unlike the well-known HTML, the goal of CNXML is to convey the content of the material and not a particular presentation. For example, say you have the following sentence: I like cupcakes very much. However, you feel that you enthusiasm for cupcakes has not been fully expressed. In HTML, you would use bold, underline, italic, etc.; in CNXML, you would use the emphasis tag.

Inline Tags

Inline tags, such as emphasis, are used to embed content and functionality inside the structural tags, such as paragraphs. Some of the more commonly used tags are discussed below.

Emphasis

As mentioned previously, the emphasis tag is used to accent certain text. Note that this refers to semantic emphasis and not a typeface. Different stylesheets can render emphasis with different typefaces.

Example 1

<para id='intro'>
  Gardenias are my absolute <emphasis>favorite</emphasis> flower.  
  Their petals are soft, and their bloom has an absolutely 
  <emphasis>heavenly</emphasis> scent.
</para>     

The above markup will display as:

Gardenias are my absolute favorite flower. Their petals are soft, and their bloom has an absolutely heavenly scent.

Term

The term tag is used to mark words or phrases which are being defined. However, its use is confined to either a para or definition tag. The term tag has one optional attribute: src - a URL specifying the source or definition of the term.

Example 2

<para id='gardenia'>
  <term src="http://en.wikipedia.org/wiki/Gardenia">Gardenias</term> 
  can be tricky to maintain.  The soil around the roots of a 
  <term>gardenia</term> must remain moist always, but too much water 
  can damage the plant.  Also, <term>gardenias</term> enjoy the sun, 
  but if the <emphasis>foliage</emphasis> gets wet to bring the 
  gardenia into the shade.
</para>      

The above markup will display as:

Gardenias can be tricky to maintain. The soil around the roots of a gardenia must remain moist always, but too much water can damage the plant. Also, gardenias enjoy the sun, but if the foliage gets wet to bring the gardenia into the shade.

Note

The note tag creates an "out of line" note (which could be a warning, point of interest, etc.) to the reader. The type of note is specified by an optional type attribute. If a type is not specified, the default is Note.

Example 3

<para id='pollen'>
  Receiving flowers is, on the whole, a wonderful thing.  
  However, sometimes pollen from the flowers can cause 
  problems.  In particular, the clean up of a bit of 
  pollen can be tricky.  <note type="Important">Do not 
  use water when cleaning up pollen!  This can lead to 
  counter-top and clothing stains!</note>  Your best bet 
  is to use a dry method of cleaning with a paper-towel.
</para>      

The above markup will display as:

Receiving flowers is, on the whole, a wonderful thing. However, sometimes pollen from the flowers can cause problems. In particular, the clean up of a bit of pollen can be tricky.

Important:
Do not use water when cleaning up pollen! This can lead to counter-top and clothing stains!
Your best bet is to use a dry method of cleaning, with a paper-towel, for example.

CNXN and Link

The cnxn and link tags are used for linking to other documents. The cnxn tag is specifically used for linking to other documents in the Connexions system, while the link tag is used for linking to general documents on the internet.

The cnxn tag has four attributes:

  • target - targets a specific tag within a document
  • document - targets a specific document by its ID
  • version - targets a specific version of a document
  • strength - designates the degree to which the linked information is related to the current document
The version attribute is optional. When not specified the cnxn will default the link to the most current version of the document. If you specify a specific version of a document, it will never change, meaning important parts, such as paragraphs or figures, will not disappear without warning. On the other hand, you will not see any updated information in that document if you specify the version.

The target and document attributes can be used together or alone. If both are used then you will link to a particular place in another document. If only document is used, you will link to a document as a whole. If only target is used, you will link to a particular tag within the current document.

The strength attribute is optional and can give the reader an indication of how related the additional information is to the current discussion.

Example 4: CNXN Example

The cnxn tag does not have to have a description of the destination in order to be used. For example, say you want to link to a figure. You could you use a cnxn similar to the one below:

    <cnxn target='tbonefig' document="m10278"/>

The above markup will display as:

(Reference)

Notice how the display says "(Reference)". When you point to something that it not within the document, this will be the display. However, pointing to a tag within the document has a different display:

    <cnxn target="element-852"/>

Figure 1

Figure 1: Picture taken by Jennifer Drummond (CC Attribution).
Figure 1 (alb_jul_flo_1.jpg)

Using an empty cnxn tag like this is an easy way to point to a specific part of a document; all the numbering is done for you, and if you need to insert a new figure in the middle of the document, the numbering will change automatically.

Example 5: CNXN example

Also, you can use your own text instead of the autogenerated text:

<cnxn target='element-852'>Momosa Picture</cnxn>

The above markup will display as:

Momosa Picture

Example 6: Link Example

<para id='moretips'>
  For more gardening tips, see 
  <link src="http://www.bhg.com/bhg/gardening/index.jhtml">Better 
  Homes and Gardens' Garden Section</link>.  
</para>   

The above markup will display as:

For more gardening tips, see Better Homes and Gardens' Garden Section.

Cite

The cite tag is used to refer to non-electronic materials within a document, and primarily contains the title, the author, and/or a page number of a work.

Example 7: Cite Example

Finally, a good resource is the <cite>Garden Lover's 
Cookbook -- William M. Rice; Paperback</cite>.

The above markup will display as:

Finally, a good resource is the Garden Lover's Cookbook -- William M. Rice; Paperback.

Quote

The quote tag is used to denote that some text directly quotes another source. The quote tag has a type attribute which denotes whether the quote is inline or block.

Example 8: Quote Example

<para id='steakquote'>
  Every plant needs a different amount of water in order to grow 
  well. <quote>"If you water each plant the same, you will always 
  water too much and too little."</quote>  Also, remember the words 
  of Lou Erickson: 
  <quote type='block'>"Gardening requires lots of water - most of 
  it in the form of perspiration."</quote>
</para>
Every plant needs a different amount of water in order to grow well. "If you water each plant the same, you will always water too much and too little." Also, remember the words of Lou Erickson:
"Gardening requires lots of water - most of it in the form of perspiration."

Foreign

The foreign tag is used to denote that a word or phrase foreign to the language of the document is being used.

Example 9: Foreign Example

<para id='steakquote2'>
  All flowers have a scientific name, often derived from latin.  
  <foreign>Gardenia augusta</foreign> is the name of a type of 
  gardenia found in Japan.
</para>
All flowers have a scientific name, often derived from latin. Gardenia augusta is the name of a type of gardenia found in Japan.

Code

The code tag is used to insert example computer output/input as either inline text within a paragraph or as a block of text. The code tag has a type 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.

Example 10: Inline Code Example

For now, take a look at what the inline code looks like:


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

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

You will see more about code blocks in Advanced CNXML using Edit-In-Place.

Content actions

Download module as:

Add module to:

My Favorites (?)

'My Favorites' is a special kind of lens which you can use to bookmark modules and collections. 'My Favorites' can only be seen by you, and collections saved in 'My Favorites' can remember the last module you were on. You need an account to use 'My Favorites'.

| A lens I own (?)

Definition of a lens

Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

Who can create a lens?

Any individual member, a community, or a respected organization.

What are tags? tag icon

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

| External bookmarks