Connexions

You are here: Home » Content » The Intermediate CNXML (日本語 - Japanese)
Content Actions

The Intermediate CNXML (日本語 - Japanese)

Module by: Ricardo Radaelli-Sanchez, Hironori Takaryo Based on: The Intermediate CNXMLRicardo 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.

 テキストブックでよくあるように、チャプターやセクションの中に例を入れるでしょう。このため、ドキュメント内に例を含めることができるようにするタグを、CNXMLは提供しています。exampleタグは固有のid属性を持ち、子要素としてほとんどのタグを含むことができます。1番目は任意のnameです。詳細が知りたいならば、CNXML Specに相談してください。
例 1 
	  
<example id='tboneexam'>
  <figure id='tbonefig'>
    <name>T-Bone Steak</name>
    <media type='image/jpg' src='tbone.jpg'/>
  </figure>
</example>
	  
	

Figure

 figureタグは、ドキュメント内に図を作成するための構造を提供します。それらは2つ以上のsubfigureタグか、1つのmediaタグ、tableタグ、codeタグを含むことができます。
 figureタグは2つの属性を持っています。
  • id - 固有のIDです。必ず必要です。
  • orient - 複数のsubfigure(副図)をどのように表示するかを指定する属性です。verticalhorizontalという2つの値が入ります。ディフォルトではhorizontalが入ります。
 figureタグの任意のタグはnameです。これは図のタイトルとして使用されます。
 nameタグは上で述べられているどのタグにも従います。しかし、最も一般的に使用されるタグは、画像、動画、音声、Javaアプレットなどを含めるmediaタグです。mediaタグは2つの属性を持っています。
  • src - 表示されるメディアの場所
  • type - 表示されるメディアのタイプの定義。それは有効なMIMEの一種であるかもしれません
    • audio/FILETYPE - audio/mp3, audio/wav, etc.
    • video/FILETYPE - video/qt, video/mov, etc.
    • image/FILETYPE - image/png, image/gif, etc.
    • application/FILETYPE - application/PostScript, application/x-java-applet, etc.
 最後のタグは任意のcaptionタグです。これは図の小さな見出しを追加するのに使用されます。
例 2 
	  
<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

 subfigureタグは、1つ以上のmediacodetableを同じfigure内に含めたいときに使用します。
 subfigureタグの使い方はfigureタグと同じです。任意のid属性、任意の最初の子要素のnameタグ、1つのmediacodetableがあります。
 現在、figureorient属性は重要になるので、副図が横並びで表示されるか、縦に表示されるかに関わらず、orient属性を指定してください。
例 3 
	  
<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タグはリストを作成するのに使用されます。listタグは2つの属性をもっています。
  • id - 固有のIDです。必ず必要です。
  • type - リストのフォーマットの定義。type属性はbulleted(ディフォルト)、enumeratednamed-iteminlineという値を取ります。
 listタグには、2つの子要素があります。name(任意)とitemです。これらはリストの情報が格納されているところです。
例 4: Example List 
		
<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>
	    
	
 結果はこのようになります。
    Beer Marinade
  1. pour beer into large bowl
  2. add chili powder to taste
  3. squeeze half lime into beer marinade
  4. place steak in beer, let soak for 30 minutes
例 5: New List Types Example 

Named Item Lists

 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>
	      
	
 結果はこのようになります。
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

Inline Lists

 もう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>.
	      
	
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

 equationタグは、ASCIIテキストや数式を表示するためのmediaなどを使って、Connexions内のドキュメントで数式を表示するために使用されます。
note: しかし、数式を表示するときは、MathMLタグで数式を使うことが推奨されます。

ASCII Text and Images

 最初の子要素は、ASCIIテキストに埋め込まれたmediaタグの番号に続く、任意のnameです。
例 6 
	    
<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:
Simple Arithmetic 11+27=38 (1)

Definition

 definitionタグはConnexionsドキュメントの単語を定義するのに使用されます。それは必ずid属性を持ち、termmeaningexampleという3つの子要素を持ちます。definitionタグの使い方は少し難しいので、 7を調べることを忘れないでください。
 最初の子要素のタグは、定義された単語や熟語を含むtermタグです。この次にはいろいろなexampleを伴ったmeaningタグが来ます。この過程は繰り返されます。
例 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>
	  
	
Definition 1: T-Bone
"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," http://www.chophousecalgary.com/steak.html.
 
T-Bone Steak
tbone.jpg
図 1

Rule

 ruleタグは、定理、原理、経験則などのルールを、CNXMLドキュメントに挿入するのに使用されます。それは2つの属性を持っています。
  • id - 固有のID。必ず必要です。
  • type - ルールの種類。必ず必要です。(例えば定理、原理、経験則)
 また任意のnameタグ、1つ以上のstatementタグ、proofもしくはexampleタグを持つかもしれません。

Statement

 statementタグはruleタグの中で使用され、ルールの宣言を定義します。任意のid属性を持ちます。また、paraequationの2つの子要素を持ちます。

Proof

 proofタグはruleタグの中で使用され、ルールの証拠をマークします。それは任意のid属性を持ち、別のrule、paraequationfigurelistタグを持つことがあります。

Using rule

例 8 
	    
<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>
	    
	  
law 1: Murphy's Law 
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.
Proof
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に相談してください。

Comments, questions, feedback, criticisms?

Discussion forum

Send feedback