質問するログイン新規登録

質問編集履歴

2

追記2(xml,xsl,変換後のxml)

2015/06/21 11:31

投稿

yamanoharu0129
yamanoharu0129

スコア47

title CHANGED
File without changes
body CHANGED
@@ -75,4 +75,65 @@
75
75
  追記
76
76
  すみません、これです。
77
77
 
78
- ![イメージ説明][WIDTH:519](95ee0bf6b28e2de4779693d46b7b0570.jpeg)
78
+ ![イメージ説明][WIDTH:519](95ee0bf6b28e2de4779693d46b7b0570.jpeg)
79
+
80
+
81
+ 追記2
82
+ XMLです。すみません、忘れていたのですが、xslで変換しています…
83
+ ```lang-<?xml version="1.0" encoding="Shift_JIS" ?>
84
+ <cars>
85
+ <car>
86
+ <name>乗用車</name>
87
+ <price>150</price>
88
+ </car>
89
+ <car>
90
+ <name>トラック</name>
91
+ <price>500</price>
92
+ </car>
93
+ <car>
94
+ <name>オープンカー</name>
95
+ <price>200</price>
96
+ </car>
97
+ </cars>
98
+ ```
99
+
100
+ xslが
101
+ ```lang-<?xml version="1.0" encoding="Shift_JIS" ?>
102
+ <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
103
+ <xsl:output method="xml" encoding="Shift_JIS" />
104
+ <!-- 文書 -->
105
+ <xsl:template match="/">
106
+ <xsl:processing-instruction name="xml-stylesheet">
107
+ type="text/css" href="sample.css"
108
+ </xsl:processing-instruction>
109
+ <root>
110
+ <xsl:apply-templates select="cars" />
111
+ </root>
112
+ </xsl:template>
113
+ <!-- 車リスト -->
114
+ <xsl:template match="cars">
115
+ <cars>車リストを処理しました。</cars>
116
+ <xsl:apply-templates select="car" /><!-- 次の変換対象を指定 -->
117
+ </xsl:template>
118
+ <!-- 車 -->
119
+ <xsl:template match="car">
120
+ <car>車を一台消しました。</car>
121
+ <xsl:apply-templates select="name" /> <!--次の変換対象を指定 -->
122
+ <xsl:apply-templates select="price" /><!-- 次の変換対象を指定 -->
123
+ </xsl:template>
124
+ <xsl:template match="name">
125
+ <name>車名を処理しました。</name>
126
+ </xsl:template>
127
+ <xsl:template match="price">
128
+ <price>価格を処理しました。</price>
129
+ </xsl:template>
130
+ </xsl:stylesheet>
131
+ ```
132
+ 変換後のxmlが
133
+ ```lang-<?xml version="1.0" encoding="Shift_JIS"?><?xml-stylesheet
134
+ type="text/css" href="sample.css"
135
+ ?>
136
+ <root><cars>車リストを処理しました。</cars><car>車を一台消しました。</car><name>車名を処理しました。</name><price>価格を処理しました。</price><car>車を一台消しました。</car><name>車名を処理しました。</name><price>価格を処理しました。</price><car>車を一台消しました。</car><name>車名を処理しました。</name><price>価格を処理しました。</price></root>
137
+ コード
138
+ ```
139
+ です。質問に際し、重要なところを書き忘れてしまい申し訳ありません。

1

スクショ付随

2015/06/21 11:31

投稿

yamanoharu0129
yamanoharu0129

スコア47

title CHANGED
File without changes
body CHANGED
@@ -70,4 +70,9 @@
70
70
  コード
71
71
  ```
72
72
  レイアウトのイメージは以下の通りです。
73
- ![イメージ説明][WIDTH:456](cc6cf5a41b5e57b202660104dfef49d5.png)
73
+ ![イメージ説明][WIDTH:456](cc6cf5a41b5e57b202660104dfef49d5.png)
74
+
75
+ 追記
76
+ すみません、これです。
77
+
78
+ ![イメージ説明][WIDTH:519](95ee0bf6b28e2de4779693d46b7b0570.jpeg)