XMLの授業で、XMLをcssでレイアウトする課題をしているのですが、評価対象のXMLの方は完成しましたがcssがさっぱりで、XMLとxslだけなら提出出来るのですが、レイアウトが整わず、止まっています。boxやblock、z-index、floatで試しましたが、上手くいきません。初歩の初歩ですが、ヒントを教えていただきたいです。よろしくお願いします。
XMLは
lang
1<title1> 2 <title2> 3 <word1>文章1</word1> 4 <word2>文章2</word2> 5 </title2> 6 <title2> 7 <word1>文章1</word1> 8 <word2>文章2</word2> 9 </title2> 10 <title2> 11 <word1>文章1</word1> 12 <word2>文章2</word2> 13 </title2> 14</title1> 15
cssは以下の通りです。悩んだのですが、全く出来ません。
lang
1title1{ 2 display:block; 3 width:230pt; 4 height:220pt; 5 background-color:rgb(200,200,200); 6 padding:18pt; 7 font-weight:bold; 8 font-size:18pt; 9 text-align:left; 10 11} 12title2{ 13 display:inline-block; 14 vertical-align:middle; 15 width:180pt; 16 height:30pt; 17 background-color:rgb(255,069,000); 18 padding:18pt; 19 margin:5px; 20 font-weight:normal; 21 font-size:12pt; 22 text-align:center; 23 24} 25word1{ 26 display:inline-block; 27 vertical-align: middle; 28 width:250pt; 29 height:50pt; 30 background-color:rgb(255,204,51); 31 padding:18pt; 32 margin:5px; 33 font-weight:normal; 34 font-size:12pt; 35 text-align:center; 36 37} 38word2{ 39 display:block; 40 width:180pt; 41 height:30pt; 42 background-color:rgb(204,255,51); 43 padding:18pt; 44 margin:5px; 45 font-weight:normal; 46 font-size:12pt; 47 text-align:center; 48} 49コード
レイアウトのイメージは以下の通りです。
![イメージ説明]WIDTH:456
追記
すみません、これです。
![イメージ説明]WIDTH:519
追記2
XMLです。すみません、忘れていたのですが、xslで変換しています…
lang
1<cars> 2 <car> 3 <name>乗用車</name> 4 <price>150</price> 5 </car> 6 <car> 7 <name>トラック</name> 8 <price>500</price> 9 </car> 10 <car> 11 <name>オープンカー</name> 12 <price>200</price> 13 </car> 14</cars>
xslが
lang
1<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> 2 <xsl:output method="xml" encoding="Shift_JIS" /> 3 <!-- 文書 --> 4 <xsl:template match="/"> 5 <xsl:processing-instruction name="xml-stylesheet"> 6 type="text/css" href="sample.css" 7 </xsl:processing-instruction> 8 <root> 9 <xsl:apply-templates select="cars" /> 10 </root> 11 </xsl:template> 12 <!-- 車リスト --> 13 <xsl:template match="cars"> 14 <cars>車リストを処理しました。</cars> 15 <xsl:apply-templates select="car" /><!-- 次の変換対象を指定 --> 16 </xsl:template> 17 <!-- 車 --> 18 <xsl:template match="car"> 19 <car>車を一台消しました。</car> 20 <xsl:apply-templates select="name" /> <!--次の変換対象を指定 --> 21 <xsl:apply-templates select="price" /><!-- 次の変換対象を指定 --> 22 </xsl:template> 23 <xsl:template match="name"> 24 <name>車名を処理しました。</name> 25 </xsl:template> 26 <xsl:template match="price"> 27 <price>価格を処理しました。</price> 28 </xsl:template> 29</xsl:stylesheet>
変換後のxmlが
lang
1 type="text/css" href="sample.css" 2 ?> 3<root><cars>車リストを処理しました。</cars><car>車を一台消しました。</car><name>車名を処理しました。</name><price>価格を処理しました。</price><car>車を一台消しました。</car><name>車名を処理しました。</name><price>価格を処理しました。</price><car>車を一台消しました。</car><name>車名を処理しました。</name><price>価格を処理しました。</price></root> 4コード
です。質問に際し、重要なところを書き忘れてしまい申し訳ありません。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2015/06/19 12:16
2015/06/19 16:56
2015/06/21 02:27
2015/06/21 05:42
2015/06/21 06:41
2015/06/21 07:28
2015/06/21 07:47
2015/06/21 08:31
2015/06/21 08:49
2015/06/21 10:57
2015/06/21 11:33
2015/06/21 11:49
2015/06/21 11:53
2015/06/21 11:55
2015/06/21 12:29
2015/06/21 12:41
2015/06/21 13:33
2015/06/21 23:39
2015/06/22 04:01
2015/06/22 10:47