Based on: The Intermediate CNXML by Ricardo Radaelli-Sanchez
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.
This module contains Connexions documentation which is out-of-date. The contents of this module are provided here for historical purposes only and should not be considered accurate for the current version of the Connexions website. The current (English-language) version of this module can be located at http://cnx.org/content/m9006/latest/. If you have any additional questions or cannot find the answer to your question, please contact techsupport@cnx.org and we will be happy to assist in any way we can.
If you would like to assist Connexions by helping us update this module with an appropriate translation from the current English version, please contact us at cnx@cnx.org as we would appreciate your help with improving our support for non-English-speaking users.
テキストブックでよくあるように、チャプターやセクションの中に例を入れるでしょう。このため、ドキュメント内に例を含めることができるようにするタグを、CNXMLは提供しています。exampleタグは固有のid属性を持ち、子要素としてほとんどのタグを含むことができます。1番目は任意のnameです。詳細が知りたいならば、CNXML Specに相談してください。
<example id='tboneexam'>
<figure id='tbonefig'>
<name>T-Bone Steak</name>
<media type='image/jpg' src='tbone.jpg'/>
</figure>
</example>
figureタグは、ドキュメント内に図を作成するための構造を提供します。それらは2つ以上のsubfigureタグか、1つのmediaタグ、tableタグ、codeタグを含むことができます。
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>
subfigureタグは、1つ以上のmedia、code、tableを同じfigure内に含めたいときに使用します。
subfigureタグの使い方はfigureタグと同じです。任意のid属性、任意の最初の子要素のnameタグ、1つのmedia、code、tableがあります。
現在、figureのorient属性は重要になるので、副図が横並びで表示されるか、縦に表示されるかに関わらず、orient属性を指定してください。
<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>
<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>
CNXML0.5では2つの新しいタイプのリストを使うことができます。最初のタイプはnamed 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>
もう1つの新しいタイプのリストはinlineリストです。このタイプのリストは以下のようになります。
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>.
equationタグは、ASCIIテキストや数式を表示するためのmediaなどを使って、Connexions内のドキュメントで数式を表示するために使用されます。
最初の子要素は、ASCIIテキストに埋め込まれたmediaタグの番号に続く、任意のnameです。
<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>
definitionタグはConnexionsドキュメントの単語を定義するのに使用されます。それは必ずid属性を持ち、term、meaning、exampleという3つの子要素を持ちます。definitionタグの使い方は少し難しいので、Example 7を調べることを忘れないでください。
最初の子要素のタグは、定義された単語や熟語を含むtermタグです。この次にはいろいろなexampleを伴ったmeaningタグが来ます。この過程は繰り返されます。
<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 |
|---|
![]() |
ruleタグは、定理、原理、経験則などのルールを、CNXMLドキュメントに挿入するのに使用されます。それは2つの属性を持っています。
id - 固有のID。必ず必要です。 type - ルールの種類。必ず必要です。(例えば定理、原理、経験則) proofタグはruleタグの中で使用され、ルールの証拠をマークします。それは任意のid属性を持ち、別のrule、para、equation、figure、listタグを持つことがあります。
<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>
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.
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 http://www.lylemariam.com/murphy.htm.
更なる情報はThe Advanced CNXMLを見てください。またはCNXML Specに相談してください。