Summary: This is the second installment of the CNXML language tutorials. It is designed to give a more comprehensive look at the CNXML tags and explain some more advanced uses of the language. Includes helpful examples of CNXML tags, extending the module created in The Basic CNXML tutorial.
<example id='tboneexam'>
<figure id='tbonefig'>
<name>T-Bone Steak</name>
<media type='image/jpg' src='tbone.jpg'/>
</figure>
</example>
figureタグは2つの属性を持っています。
id - 固有のIDです。必ず必要です。orient - 複数のsubfigure(副図)をどのように表示するかを指定する属性です。verticalかhorizontalという2つの値が入ります。ディフォルトではhorizontalが入ります。 figureタグの任意のタグはnameです。これは図のタイトルとして使用されます。
nameタグは上で述べられているどのタグにも従います。しかし、最も一般的に使用されるタグは、画像、動画、音声、Javaアプレットなどを含めるmediaタグです。mediaタグは2つの属性を持っています。
src - 表示されるメディアの場所type - 表示されるメディアのタイプの定義。それは有効なMIMEの一種であるかもしれません
captionタグです。これは図の小さな見出しを追加するのに使用されます。
<figure id='tbone'>
<name>T-Bone Steak</name>
<media type='image/jpeg' src='tbone.jpg'/>
<caption>
Upon successful completion of these documents, you should be able
to grill a steak that looks just as good!
</caption>
</figure>
<figure orient='horizontal' id='horfig'>
<name>Steaks</name>
<subfigure id='subfigtbone1'>
<name>T-Bone</name>
<media type='image/jpeg' src='tbone.jpg'/>
</subfigure>
<subfigure id='subfingnystrip1'>
<name>New York Strip</name>
<media type='image/jpeg' src='ny_strip.gif'/>
</subfigure>
<caption>
Upon successful completion of these documents, you
should be able to grill a steak that looks just as good!
</caption>
</figure>
Or
<figure orient='vertical' id='verfig'>
<name>Steaks</name>
<subfigure id='subfigtbone2'>
<name>T-Bone</name>
<media type='image/jpeg' src='tbone.jpg'/>
</subfigure>
<subfigure id='subfig2'>
<name>New York Strip</name>
<media type='image/jpeg' src='ny_strip.jpg'/>
</subfigure>
<caption>
Upon successful completion of these documents, you
should be able to grill a steak that looks just as good!
</caption>
</figure>
listタグはリストを作成するのに使用されます。listタグは2つの属性をもっています。
id - 固有のIDです。必ず必要です。type - リストのフォーマットの定義。type属性はbulleted(ディフォルト)、enumerated、named-item、inlineという値を取ります。listタグには、2つの子要素があります。name(任意)とitemです。これらはリストの情報が格納されているところです。
<list id='marinade' type='enumerated'> <name>Beer Marinade</name> <item>pour beer into large bowl</item> <item>add chili powder to taste</item> <item>squeeze half lime into beer marinade</item> <item>place steak in beer, let soak for 30 minutes</item> </list>結果はこのようになります。
type属性にnamed-itemと指定してください。名前のあるリストの各アイテムは名前を持ちます。
<list id='marinade' type='named-item'> <name>Beer Marinade</name> <item><name>Step 1</name>pour beer into large bowl</item> <item><name>Step 2</name>add chili powder to taste</item> <item><name>Step 3</name>squeeze half lime into beer marinade</item> <item><name>Step 4</name>place steak in beer, let soak for 30 minutes</item> </list>結果はこのようになります。
| Beer Marinade | ||
| Step 1 | - | pour beer into large bowl |
| Step 2 | - | add chili powder to taste |
| Step 3 | - | squeeze half lime into beer marinade |
| Step 4 | - | place steak in beer, let soak for 30 minutes |
In order to make a good marinade follow these directions:<list id='marinade' type='inline'> <name>Beer Marinade</name> <item><name>Step 1</name>pour beer into large bowl</item> <item><name>Step 2</name>add chili powder to taste</item> <item><name>Step 3</name>squeeze half lime into beer marinade</item> <item><name>Step 4</name>place steak in beer, let soak for 30 minutes</item> </list>.The resulting list will look like: In order to make a good marinade follow these directions: Beer Marinade: Step 1 - pour beer into large bowl; Step 2 - add chili powder to taste; Step 3 - squeeze half lime into beer marinade; Step 4 - place steak in beer, let soak for 30 minutes
equationタグは、ASCIIテキストや数式を表示するためのmediaなどを使って、Connexions内のドキュメントで数式を表示するために使用されます。
<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>
This equation will display as:
definitionタグはConnexionsドキュメントの単語を定義するのに使用されます。それは必ずid属性を持ち、term、meaning、exampleという3つの子要素を持ちます。definitionタグの使い方は少し難しいので、例 7を調べることを忘れないでください。
<definition id='tbonedef'>
<term>T-Bone</term>
<meaning>
"The T-bone steak is cut between 1 and 3 inches thick and comes
from the center section of the short loin. This steak is
characterized by its T-shape bone, has a fine-grained shell and a
small tenderloin eye,"
<cite>http://www.chophousecalgary.com/steak.html</cite>.
</meaning>
<example id='tboneexam'>
<figure id='tbonefig'>
<name>T-Bone Steak</name>
<media type='image/jpeg' src='tbone.jpg'/>
</figure>
</example>
</definition>
T-Bone Steak![]() 図 1 |
ruleタグは、定理、原理、経験則などのルールを、CNXMLドキュメントに挿入するのに使用されます。それは2つの属性を持っています。
id - 固有のID。必ず必要です。type - ルールの種類。必ず必要です。(例えば定理、原理、経験則)
<rule id='murph' type='law'>
<name>Murphy's Law</name>
<statement>
<para id='murphp1'>
If there are two or more ways to do something, and one of those
ways can result in a catastrophe, then someone will do it.
</para>
</statement>
<proof>
<para id='murphp2'>
Edward A. Murphy, Jr. was one of the engineers on the
rocket-sled experiments that were done by the U.S. Air Force in
1949 to test human acceleration tolerances (USAF project
MX981). One experiment involved a set of 16 accelerometers
mounted to different parts of the subject's body. There were two
ways each sensor could be glued to its mount, and somebody
methodically installed all 16 the wrong way around. Murphy then
made the original form of his pronouncement, which the test
subject (Major John Paul Stapp) quoted at a news conference a
few days later
<cite>http://www.lylemariam.com/murphy.htm</cite>.
</para>
</proof>
</rule>
Comments, questions, feedback, criticisms?