XSL/XSLT (558レス)
XSL/XSLT http://medaka.5ch.io/test/read.cgi/php/999654569/
上
下
前
次
1-
新
通常表示
512バイト分割
レス栞
147: nobodyさん [sage] 02/10/02 00:23 ID:??? 他板でこんなスレ見つけました。 XML使いの板 http://pc3.2ch.net/test/read.cgi/hp/984950028/ レベル低め、XSLT中心、WEBでの利用。 他にXML語れる所知りませんか? http://medaka.5ch.io/test/read.cgi/php/999654569/147
148: nobodyさん [sage] 02/10/02 11:18 ID:??? >>上様 こんなの。 XML [WebProg] コンテンツとデザインの分離 [WebProg] XMLの必要性 [プログラム] XMLプログラミング [プログラム] XMLを限り無くオカルトに語る [心と宗教] http://medaka.5ch.io/test/read.cgi/php/999654569/148
149: 147 [sage] 02/10/02 14:08 ID:??? >>148 サンクス 全部見てきたよ。 ……最後のスレ、こいつは… http://medaka.5ch.io/test/read.cgi/php/999654569/149
150: nobodyさん [] 02/10/05 16:58 ID:eN4sGb4j 普通のプロバに設置するCGIでXLSTできないかなあ http://medaka.5ch.io/test/read.cgi/php/999654569/150
151: nobodyさん [sage] 02/10/05 23:24 ID:??? >>150 IEならXSLT入ってるぞ。 …てのはだめなんだよな。 おれも情報きぼん http://medaka.5ch.io/test/read.cgi/php/999654569/151
152: nobodyさん [sage] 02/10/07 05:30 ID:??? 拾ってきた http://pc3.2ch.net/test/read.cgi/tech/1014643296/147 http://medaka.5ch.io/test/read.cgi/php/999654569/152
153: nobodyさん [age] 02/10/11 04:30 ID:??? XSLTパーサのXERCESをインストールしようとしているのですが,うまくいきません. 解凍した後,コマンドラインから SET CLASSPATH=%CLASSPATH%;C:\Xerces\xerces.jar と入力しましたが,サンプルで試した所, Exception in thresd "main" java.lang.NoClassDeFoundError となってしまいました.バージョンは2.2.0です. お分かりになる方,よろしくお願いします. http://medaka.5ch.io/test/read.cgi/php/999654569/153
154: nobodyさん [] 02/10/15 01:38 ID:okBjBmnc >>153 サンプルを実行したとき、何てコマンドラインに入力したんだよ java -jar xxxx.jar か? http://medaka.5ch.io/test/read.cgi/php/999654569/154
155: nobodyさん [sage] 02/10/29 00:17 ID:??? XMLからXSLT変換で、違う形式のXMLファイルを出力したとしよう。 変換後のXMLファイルと、変換に使ったXSLTファイルを用いて、 元のXMLファイルを再現できるものだろうか? 変換 XML[A] + XSLT → XML[B] 戻す。 XML[B]の情報 + XSLTの情報 → XML[A] http://medaka.5ch.io/test/read.cgi/php/999654569/155
156: nobodyさん [sage] 02/10/29 19:23 ID:??? >>155 問題になるのは変換時に捨ててしまった情報をどうするかだと思われ。 http://medaka.5ch.io/test/read.cgi/php/999654569/156
157: nobodyさん [sage] 02/10/29 23:52 ID:??? 完全な再現は出来ないと思う。 同じXSLTを使って、おなじXML[B]を生成するのなら、出切るかもしれない。 いや、正直わからん。俺頭悪いし。 http://medaka.5ch.io/test/read.cgi/php/999654569/157
158: 八べえ [] 02/11/12 15:09 ID:gxn/By35 Cocoon2を使用して、WEB表示を行うとソースに <META http-equiv="Content-Type" content="text/html; charset=UTF-8"> が追記されてしまいます。 これにより、Shift-JISで書いているxml,xsltが文字化けを起こしています。 sitemap.xmap,cocoon.xconfをみてもそれらしき設定が見当たりません。 どのようにしたら、追記されなくなるのでしょうか? http://medaka.5ch.io/test/read.cgi/php/999654569/158
159: bloom [] 02/11/12 15:36 ID:VFQMwTMk http://homepage.mac.com/bloombloom/ http://medaka.5ch.io/test/read.cgi/php/999654569/159
160: HTMLをSJISで表示 [] 02/11/13 10:55 ID:oYHYr3JM >>158 docs/samples/hello-page.xml <?xml version="1.0" encoding="Shift_JIS"?> を入れると、正常なUTF-8に変換されるので、文字化けしない。 結果charset=UTF-8 xslt の中のoutput は利かない。 結果htmlも、SJISにする場合は、serializer に指定する。 html serializer に、sjis 版追加 <map:serializer name="html-sjis" logger="sitemap.serializer.html" mime-type="text/html" pool-grow="4" pool-max="32" pool-min="4" src="org.apache.cocoon.serialization.HTMLSerializer"> <buffer-size>1024</buffer-size> <encoding>Shift_JIS</encoding> </map:serializer> hello.html のマップをコピーして sjis バージョンを作る <map:match pattern="hello-sjis.html"><!-- ここ**--> <map:generate src="docs/samples/hello-page.xml"/> <map:transform src="stylesheets/page/simple-page2html.xsl"/> <map:serialize type="html-sjis"/><!-- ここ**--> </map:match> ばんざーい。 これで完成 結果charset=Shift_JIS http://medaka.5ch.io/test/read.cgi/php/999654569/160
161: XMLをSJISで出力 [] 02/11/13 11:03 ID:oYHYr3JM hello.html を指定すると UTF-8版が表示され、 hello-sjis.html を指定すると、 SJIS版が表示されるようになる。 別件だが xml の出力の中の encoding=UTF-8 を変更する場合は、xslt の中で、 <xsl:output omit-xml-declaration="no" encoding="Shift_JIS"/> とかやると良い。 http://medaka.5ch.io/test/read.cgi/php/999654569/161
162: 160=161 [] 02/11/13 15:02 ID:fcqFiIq0 >>160 = >>161 ばんざ〜い!! みなさんありがとうございました。 無事、SJIS表示できるようになりました。 http://medaka.5ch.io/test/read.cgi/php/999654569/162
163: 教えて下さい [] 02/11/13 17:52 ID:fcqFiIq0 xslの全ての<xsl:value-of select=....>の項目に、 「disable-output-escaping="yes"」を指定したいのですが、 まとめて設定するにはどのようにしたらよいのでしょうか? http://medaka.5ch.io/test/read.cgi/php/999654569/163
164: nobodyさん [] 02/11/15 22:35 ID:Q0ofQCcS disable-output-escaping="yes" を <xsl:value-of に追加する XSLT を書いて XSLT を変換... http://medaka.5ch.io/test/read.cgi/php/999654569/164
165: nobodyさん [] 02/11/15 23:27 ID:y2tgiCuR エディタで一括変換 http://medaka.5ch.io/test/read.cgi/php/999654569/165
166: nobodyさん [] 02/12/09 01:32 ID:eA2V6vYL すごい単純な質問なんですけど、 <a> <xsl:attribute name="href"> <xsl:value-of select="@url" /> </xsl:attribute> <xsl:attribute name="target"> _self </xsl:attribute> <xsl:value-of select="@url" /> </a> とXSLでリンクを作ったんですが、targetを _self にしても、_blank みたいに別ウィンドウでリンク先が表示されてしまいます。 _self や _top のように別ウィンドウを開かないでリンク先を表示させるにはどうすればいいのでしょうか? http://medaka.5ch.io/test/read.cgi/php/999654569/166
167: 166 [sage] 02/12/09 01:51 ID:??? 自己レスです。 <xsl:attribute name="target">_self</xsl:attribute> と繋げればうまくいきました。どうも間にリターンがあったのが原因みたいです。 http://medaka.5ch.io/test/read.cgi/php/999654569/167
168: nobodyさん [sage] 03/01/06 07:36 ID:??? DTDで <!ENTITY foo SYSTEM "bar.xml"> を XML schema で表現するにはどうすればいいんですか? http://medaka.5ch.io/test/read.cgi/php/999654569/168
169: nobodyさん [] 03/01/06 07:44 ID:L2+zJcVG しまった、ageておこう http://medaka.5ch.io/test/read.cgi/php/999654569/169
170: 山崎渉 [(^^)sage] 03/01/15 13:36 ID:??? (^^) http://medaka.5ch.io/test/read.cgi/php/999654569/170
171: nobodyさん [] 03/01/22 05:21 ID:vujRJlnb i love love generation http://medaka.5ch.io/test/read.cgi/php/999654569/171
172: ぱむ [] 03/01/28 17:32 ID:IBfGocF/ cocoonのsitemap.xmapで2つ以上のxmlを1つのxslに適用したい場合は どうすればいいんですか? <map:generate src="aaa.xml"/> <map:generate src="bbb.xml"/> <map:transform src="ccc.xsl"/> とすると「適用出来るxmlは1つだけ」というエラーが出てしまいます。 だれか宜しくお願いします。 http://medaka.5ch.io/test/read.cgi/php/999654569/172
173: nobodyさん [] 03/01/29 13:27 ID:L9yee78Z xmlは死んだ http://medaka.5ch.io/test/read.cgi/php/999654569/173
174: nobodyさん [] 03/02/11 22:52 ID:K0N8t3Ee xmlは死んだ http://medaka.5ch.io/test/read.cgi/php/999654569/174
175: nobodyさん [] 03/02/12 17:42 ID:rtj1FkeB MS、XDocsの正式名称「InfoPath」発表 http://www.zdnet.co.jp/news/0302/12/nebt_21.html MicrosoftはInfoPathで作成したフォームを使い 医療電子データ交換用形式で送るデモも実施。 同社はXFormsではなくXSLTの採用を決定 http://medaka.5ch.io/test/read.cgi/php/999654569/175
176: nobodyさん [] 03/02/12 17:56 ID:gzTJY/OJ http://www.agemasukudasai.com/bloom/ http://medaka.5ch.io/test/read.cgi/php/999654569/176
177: nobodyさん [] 03/02/20 19:11 ID:ywFHezDA 名前空間接頭辞 foo と bar を使った xml 文書があります. ---------- <foo:root xmlns:foo="http://foo-namespace" xmlns:bar="http://bar-namespace"> <bar:e1>this is <foo:e2>a</foo:e2> pen. </bar:e1> </foo:root> ---------- これを以下の xslt に食わせて, foo に属する要素を全て bar の要素に変換します. ---------- <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:foo="http://foo-namespace" xmlns:bar="http://bar-namespace" version="1.0"> <xsl:output indent="yes" omit-xml-declaration="yes" /> <xsl:template match="foo:root"><bar:root><xsl:apply-templates select="*" /></bar:root></xsl:template> <xsl:template match="foo:e2"><bar:e2><xsl:value-of select="." /></bar:e2></xsl:template> <xsl:template match="@*|node()"><xsl:copy><xsl:apply-templates select="@*|node()" /></xsl:copy></xsl:template> </xsl:stylesheet> ---------- すると,以下のような xml 文書 (多少整形してあります) が得られるのですが, ---------- <bar:root xmlns:bar="http://bar-namespace" xmlns:foo="http://foo-namespace"> <bar:e1>this is <bar:e2>a</bar:e2> pen.</bar:e1> </bar:root> ---------- 結果として全く使われていない foo に対する宣言が文書に含まれてしまいます. exclude-result-prefixes="foo" を指定しても,bar:e1 要素に宣言が現れるだけで意味がありませんでした. これを取り除く (最適化?) することはできないのでしょうか. いや,実害はないんですけど気持ち悪くて... http://medaka.5ch.io/test/read.cgi/php/999654569/177
178: 177 [sage] 03/02/20 19:13 ID:??? 書き込むときに「改行が多い!!」って怒られちゃったので 改行削ったらソースが読みづらくなってしまいました……スマンコ http://medaka.5ch.io/test/read.cgi/php/999654569/178
179: nobodyさん [sage] 03/02/21 01:48 ID:??? >>177 で、変換は何で? http://medaka.5ch.io/test/read.cgi/php/999654569/179
180: 177 [sage] 03/02/21 10:10 ID:??? >>179 えーと,「何で変換する必要があるの?」という意味でしょうか. >>177で挙げた例は,現象が再現する最小限のソースでして (もっと短くできるかもしれませんが),実際は置き換え以外にも色々やってるんです... http://medaka.5ch.io/test/read.cgi/php/999654569/180
181: nobodyさん [sage] 03/02/22 22:09 ID:??? >>180 transformer は何?という意味 http://medaka.5ch.io/test/read.cgi/php/999654569/181
182: 177 [] 03/02/23 21:47 ID:ORn8WdNQ >>181 すいません,書き忘れました. xalan-java 2.4.D1 です. http://medaka.5ch.io/test/read.cgi/php/999654569/182
183: 山崎渉 [(^^)] 03/03/13 17:11 ID:??? (^^) http://medaka.5ch.io/test/read.cgi/php/999654569/183
184: nobodyさん [sage] 03/04/02 23:28 ID:??? ほすさげ http://medaka.5ch.io/test/read.cgi/php/999654569/184
185: nobodyさん [‘‘] 03/04/07 01:23 ID:??? (MS)XSL+JavaScriptで入力フォーム(UI)を作るという方法論は間違いだったと激しく後悔中。 素直に全部JavaScriptにするか、サーバサイドで作るべきだダタヨ。 http://medaka.5ch.io/test/read.cgi/php/999654569/185
186: nobodyさん [] 03/04/07 01:46 ID:uo8jDP5o ん。XForm ではなくて、XSLで? http://medaka.5ch.io/test/read.cgi/php/999654569/186
187: 山崎渉 [(^^)] 03/04/17 12:08 ID:??? (^^) http://medaka.5ch.io/test/read.cgi/php/999654569/187
188: nobodyさん [] 03/04/19 11:48 ID:4Vo7Hobj あの・・・XSLTってタグ自身を出力できない? 下の様にすると全タグについて定義しなくてはならなくなってしまう・・ <xsl:template match="ABCD"> <ABCD> <xsl:apply-template/> </ABCD> </xsl:template> やりたいことは xmlの一部のタグだけ変換したいのですが それ以外はそのままのタグで出力したいのです copy-of とか使うと編集できないし。。。 すごくくだらない質問ですみませんが教えていただけないでしょうか? http://medaka.5ch.io/test/read.cgi/php/999654569/188
189: nobodyさん [sage] 03/04/20 04:35 ID:??? >>188 <xsl:template match="ABCD"> <xsl:element name="{local-name()}"> <xsl:apply-template/> </xsl:element> </xsl:template> ABCD をワイルドカードにすると全部引っかかる。 http://medaka.5ch.io/test/read.cgi/php/999654569/189
190: 山崎渉 [(^^)sage] 03/04/20 06:00 ID:??? ∧_∧ ( ^^ )< ぬるぽ(^^) http://medaka.5ch.io/test/read.cgi/php/999654569/190
191: nobodyさん [] 03/05/19 12:22 ID:UmHfFrg2 いい書籍ない? オライリーのはわかりにくい。 http://medaka.5ch.io/test/read.cgi/php/999654569/191
192: 山崎渉 [(^^)] 03/05/22 02:00 ID:??? ━―━―━―━―━―━―━―━―━[JR山崎駅(^^)]━―━―━―━―━―━―━―━―━― http://medaka.5ch.io/test/read.cgi/php/999654569/192
193: 山崎渉 [(^^)] 03/05/28 17:20 ID:??? ∧_∧ ピュ.ー ( ^^ ) <これからも僕を応援して下さいね(^^)。 =〔~∪ ̄ ̄〕 = ◎――◎ 山崎渉 http://medaka.5ch.io/test/read.cgi/php/999654569/193
194: 山崎 渉 [(^^)] 03/07/15 11:14 ID:??? __∧_∧_ |( ^^ )| <寝るぽ(^^) |\⌒⌒⌒\ \ |⌒⌒⌒~| 山崎渉 ~ ̄ ̄ ̄ ̄ http://medaka.5ch.io/test/read.cgi/php/999654569/194
195: 山崎 渉 [(^^)sage] 03/08/02 02:37 ID:??? ∧_∧ ( ^^ )< ぬるぽ(^^) http://medaka.5ch.io/test/read.cgi/php/999654569/195
196: ぼるじょあ ◆ySd1dMH5Gk [(^^)] 03/08/02 05:19 ID:??? ∧_∧ ∧_∧ ピュ.ー ( ・3・) ( ^^ ) <これからも僕たちを応援して下さいね(^^)。 =〔~∪ ̄ ̄ ̄∪ ̄ ̄〕 = ◎――――――◎ 山崎渉&ぼるじょあ http://medaka.5ch.io/test/read.cgi/php/999654569/196
197: 山崎 渉 [(^^)] 03/08/15 22:59 ID:??? (⌒V⌒) │ ^ ^ │<これからも僕を応援して下さいね(^^)。 ⊂| |つ (_)(_) 山崎パン http://medaka.5ch.io/test/read.cgi/php/999654569/197
198: nobodyさん [] 03/09/07 21:17 ID:PQrT+UlA <x>a b c <y>d</y> e <y>f</y> <y>g</y> h</x> を <p>a b c <q>d</q> e <q>f</q> <q>g</q> h</p> に変換する XSL が分からん。for-each じゃ出来ないよね? http://medaka.5ch.io/test/read.cgi/php/999654569/198
199: nobodyさん [] 03/09/07 23:33 ID:X8dU+/Y3 xにマッチしてpにおきかえるテンプレートと yにマッチしてqにおきかえるテンプレートをかけばいいだけじゃんよ http://medaka.5ch.io/test/read.cgi/php/999654569/199
200: nobodyさん [sage] 03/09/09 01:09 ID:??? >>199 あー、徹夜明けでボケてた。 その通りです失礼 http://medaka.5ch.io/test/read.cgi/php/999654569/200
201: nobodyさん [] 03/09/26 10:15 ID:Hq0iAR6d <date>9月2日</date> <title>ちょっとここを通られた</title> <p>なぞの白い物体に我が家をあらされてしまった。</p> <p>訴訟を起こして謝罪と賠償を要求したい。</p> を <div class="section"> <h2><date>9月2日</h2> <div class="subsection"> <h3>ちょっとここを通られた</h3> <p>なぞの白い物体に我が家をあらされてしまった。</p> <p>訴訟を起こして謝罪と賠償を要求したい。</p> </div> </div> と変換するにはXSLTをどう書けばいいのでしょうか。 http://medaka.5ch.io/test/read.cgi/php/999654569/201
202: nobodyさん [sage] 03/09/26 11:50 ID:??? >>201 まず整形式にしろ。話はそれからだ。 http://medaka.5ch.io/test/read.cgi/php/999654569/202
203: nobodyさん [sage] 03/09/26 17:56 ID:??? >>202 すみません <h2><date>9月2日</h2> は <h2>9月2日</h2> の誤りです。 http://medaka.5ch.io/test/read.cgi/php/999654569/203
204: nobodyさん [sage] 03/09/26 22:18 ID:??? >>203 整形式にしなきゃいけないのは変換前のほうなんだが。 本当にやりたいことは別にあるんじゃないかとも思うが、 とりあえず、親要素を???とすれば、こんな感じ。 <xsl:template match="???"> <div class="section"> <xsl:apply-templates select="date" /> <div class="subsection"> <xsl:apply-templates select="title" /> <xsl:apply-templates select="p" /> </div> </div> </xsl:template> <xsl:template match="date"><h2><xsl:xsl:apply-templates /></h2></xsl:template> <xsl:template match="title"><h3><xsl:xsl:apply-templates /></h3></xsl:template> <xsl:template match="p"><p><xsl:xsl:apply-templates /></p></xsl:template> http://medaka.5ch.io/test/read.cgi/php/999654569/204
205: nobodyさん [sage] 03/10/10 20:26 ID:??? 俺はサイトの文法は <section> <title>TITLE</title> <sentences><p></p>....</sentences> <section> <title>子セクションTITLE</title> <sentences><p></p>....</sentences> </section> <section> <title>子セクションTITLE</title>(以下略&再帰的な文法) </section> </section> にしてる。 http://medaka.5ch.io/test/read.cgi/php/999654569/205
206: nobodyさん [sage] 03/10/14 00:50 ID:??? >>205 俺もそんな感じ http://medaka.5ch.io/test/read.cgi/php/999654569/206
207: nobodyさん [] 03/10/17 21:05 ID:ckGd54O2 質問です。 XSLTで、元の構造を保ったまま、 XMLのテキストを一部分だけ変えるというのは簡単に出来るのでしょうか? 例えば、簡単な例ですが、 <A> <B>hoge</B> </A> とあったときにhogeを何か別の文字列に変換したいという事です。 やはりその構造にあった、スタイルシートを書くしかないのでしょうか? http://medaka.5ch.io/test/read.cgi/php/999654569/207
208: nobodyさん [sage] 03/10/18 00:03 ID:??? >>207 どの要素内容のテキストのhogeも全部書き換えていいなら簡単。 でも、そのためにXSLTを使うなんて馬鹿げてる。 http://medaka.5ch.io/test/read.cgi/php/999654569/208
209: nobodyさん [sage] 03/10/18 14:56 ID:??? >>208 そういうことのためにXSLTがあるんじゃないの? それが馬鹿げてるってことはXSLT自体が馬鹿げてるってことだろ。 http://medaka.5ch.io/test/read.cgi/php/999654569/209
210: nobodyさん [sage] 03/10/19 10:59 ID:??? >>209 スキーマを換えるためにあると考えるのが普通だろ。 単なる置換とはぜんぜん違うよ。 http://medaka.5ch.io/test/read.cgi/php/999654569/210
211: nobodyさん [sage] 03/10/19 17:43 ID:??? XMLをXSLでHTMLに変換して、↓のような感じにしたいです。 何がしたいのかというとページ内リンクがしたくて、 c要素を変換した(1*)や(*2)などを押すと、 f要素の(*1)や(*2)に飛びたいのです。 <?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet href="sample.xsl" type="text/XSL"?> <A> <b>テキスト1<c id="A" /></b> <b>テキスト2<c id="B" /></b> <b>テキスト3<c id="A" /></b> <b>テキスト4<c id="A" /></b> <e> <f id="A">参照テキスト</f> <f id="B">参照テキスト</f> </e> </a> ↓変換↓ テキスト1(*1) テキスト2(*2) テキスト3(*1) テキスト4(*1) (*1)参照テキスト (*2)参照テキスト http://medaka.5ch.io/test/read.cgi/php/999654569/211
212: 211の続き [sage] 03/10/19 17:44 ID:??? ページ内リンク自体は簡単にできるのですが、 (*1)、(*2)などの番号を振るのが難しいです。 f要素の番号は単純にnumberでカウントしているのですが、 c要素での番号が振れません。 xslはネットをうろついて見つけた近そうなものを 参考にしながら、こんな感じになっています。 ↓ http://medaka.5ch.io/test/read.cgi/php/999654569/212
213: 212の続き [sage] 03/10/19 17:48 ID:??? <?xml version="1.0" encoding="Shift_JIS"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="html" version="4.0" encoding="Shift_JIS" /> <xsl:template match="/"> <html><head><title>sample</title></head><body> <xsl:apply-templates /> </body></html> </xsl:template> <xsl:template match="b"> <div><xsl:apply-templates /></div> </xsl:template> <xsl:template match="c"> <xsl:variable name="ID" select="@id" /> <xsl:element name="a"> <xsl:attribute name="href">#<xsl:value-of select="@id" /></xsl:attribute> (*<xsl:number count="f" /><xsl:value-of select="../../e/f/@id[../@id=$ID]" />) </xsl:element> <xsl:apply-templates /> </xsl:template> http://medaka.5ch.io/test/read.cgi/php/999654569/213
214: 213の続き [sage] 03/10/19 17:49 ID:??? <xsl:template match="f"> <div> <xsl:element name="a"> <xsl:attribute name="name"><xsl:value-of select="@id" /></xsl:attribute> (*<xsl:number count="f" />) </xsl:element> <xsl:apply-templates /> </div> </xsl:template> </xsl:stylesheet> f要素にマッチングさせたnumberをとかを取得できればいいのかなーと思って、 いろいろと考えてみたのですが、↑まで書いたところで???になりました。 どなたかお知恵を貸してください。。。。 http://medaka.5ch.io/test/read.cgi/php/999654569/214
215: nobodyさん [] 03/11/29 01:53 ID:0RUQwDGu どうか皆様のお力をお借りしたく思います。 xmlが <item> <text> ああああああああああ ああああああああああ ああああああああああ </text> <text> いいいいい<em>イイイイイ</em> <br /> いいいいいいいいいい <br /> いいいいいいいいいい <br /> </text> </item> このように与えられていて、これを <!-- タグ付きで、そのまま出力 --> <p> ああああああああああ ああああああああああ ああああああああああ </p> <p> いいいいい<em>イイイイイ</em> <br /> いいいいいいいいいい <br /> いいいいいいいいいい <br /> </p> <!-- タグを削って 32bytes に切り詰め、最後の 3bytes を '...' に変換し、出力 --> <p>ああああああああああああああ ...</p> <p>いいいいいイイイイイいいいい ...</p> このように出力したいのですが、xslはどのように書けばよいのでしょうか。 http://medaka.5ch.io/test/read.cgi/php/999654569/215
216: 215 [sage] 03/11/30 02:13 ID:??? 「タグ付きで、そのまま出力」 は xsl:copy-of を使用して解決しました。 「タグを削って 32bytes に切り詰め、最後の 3bytes を '...' に変換し、出力」 は未解決です。 どなたか御協力を賜りたく思います。 http://medaka.5ch.io/test/read.cgi/php/999654569/216
217: nobodyさん [sage] 03/11/30 02:59 ID:??? 仕様書読んだことある? プログラミング言語の経験は? http://medaka.5ch.io/test/read.cgi/php/999654569/217
218: 215 [sage] 03/11/30 05:20 ID:??? 「タグを削って 32bytes に切り詰め、最後の 3bytes を '...' に変換し、出力」 も自己解決しました。 お騒がせして御免なさい。 >217 >仕様書 少しは読みますが、リファレンス的です。 >プログラミング言語 c/c++ を使う事が出来ます。 http://medaka.5ch.io/test/read.cgi/php/999654569/218
219: nobodyさん [] 04/01/02 03:53 ID:goN3d3Pm XSLTで1つのXMLファイル上に存在するn件のデータを50件ずつ表示を 行いたいんだけど、そういうことって簡単にできますか? どんな感じで実装すれば良いのかご存知の方教えてください。 javascriptでXSLTを触らないとダメなのかな・・。 http://medaka.5ch.io/test/read.cgi/php/999654569/219
220: nobodyさん [sage] 04/01/02 13:08 ID:??? >>219 トップレベルの xsl:param へ実行時にパラメータを渡せるから、 それで、a < position() and position() <= a + 50 とかすれ。 http://medaka.5ch.io/test/read.cgi/php/999654569/220
221: nobodyさん [] 04/01/02 14:59 ID:goN3d3Pm >>220 IEから外部パラメータとして与える方法を探したけどどうしてもわかりません。 普通に/list.xml&index=50とかURL書いても無視されるし。 http://medaka.5ch.io/test/read.cgi/php/999654569/221
222: nobodyさん [sage] 04/01/02 15:25 ID:??? >>221 クライアント側で変換させるなんて論外じゃねぇの http://medaka.5ch.io/test/read.cgi/php/999654569/222
223: nobodyさん [] 04/01/02 16:08 ID:goN3d3Pm >>222 え・・そうなんすか。 ホントXML全然知らないんで、とんちんかんなレスになっちゃうかも しれないけど、XSLTってユーザーの入力値にマッチした情報の抽出を行うとか、 そういう制御は得意かと思っていたんですが違うんですか? それはサーバサイドでやるべき事っていうことですか。 根本的なところを理解していなかったか・・_| ̄|〇ガックリ http://medaka.5ch.io/test/read.cgi/php/999654569/223
224: nobodyさん [sage] 04/01/02 18:25 ID:??? >>223 何が得意かとサーバでやるべきかどうかには何の関係もないと思うけど http://medaka.5ch.io/test/read.cgi/php/999654569/224
225: nobodyさん [sage] 04/01/10 22:17 ID:??? 保守。 ♥ ? ?x2665; http://medaka.5ch.io/test/read.cgi/php/999654569/225
226: nobodyさん [sage] 04/01/14 03:43 ID:??? 不具合か Mozillaでバッチリなのに IE で真っ白ってどういうことだ http://medaka.5ch.io/test/read.cgi/php/999654569/226
227: 225 [sage] 04/01/17 15:58 ID:??? 順番を入れ替えただけでうまくいくってのはどういうこった http://medaka.5ch.io/test/read.cgi/php/999654569/227
228: 227 [sage] 04/01/17 15:59 ID:??? 名前は226だった http://medaka.5ch.io/test/read.cgi/php/999654569/228
229: 226 227 228 [sage] 04/01/17 16:17 ID:??? >>221 外部パラメータを与えるxmlを用意すれば、やりたい事をかなえてくれる <?xml version="1.0" encoding="UTF-8" ?> <?xml-stylesheet version="1.0" encoding="UTF-8" type="text/xsl" href="page.xsl" ?> <page index="50"> </page> みたいな中身のないxmlを用意し、xslで <xsl:param name="index" select="/page/@index" /> をよませるのだ。 xslでは 220の <xsl:if test=" ( $index < position() ) and ( position() <= $index + 50 )"> を使う。 page.xml (中身あり) では<page index="0">、 page1.xml (中身なし) では<page index="50">、 page2.xml (中身なし) では<page index="100">、 page3.xml (中身なし) では<page index="150">、と書いておく。 page.xsl では <xsl:copy-of select="document( "page.xml" )/page/foo" /> みたいな、ドキュメントを指定した形で読み込む。 ( select="/page/foo" では不可能。<xsl:template match="/page/foo"> も恐らく無理 ) おすすめは xsl:for-each <xsl:template match="/page"> <xsl:param name="index" select="/page/@index" /> <xsl:for-each select="document( "page.xml" )/page/foo"> <xsl:if test=" ( $index < position() ) and ( position() <= $index + 50 )"> <xsl:copy-of select="current()" /> </xsl:if> </xsl:for-each> </xsl:template> と、こんな感じではないかな。 ところどころ間違いがあるかもしれないが、その辺は勘弁してくれ http://medaka.5ch.io/test/read.cgi/php/999654569/229
230: nobodyさん [] 04/01/26 15:30 ID:TZ0JMGYO データの格納をXMLに任せて、フォーム使ったCGI作りたいのですけど よいサンプルページないですか? 表示はXHTMLでやってます。 http://medaka.5ch.io/test/read.cgi/php/999654569/230
231: nobodyさん [] 04/01/27 19:27 ID:b8cLgywQ <item name="WebSite" href="URL" />のような一風変わったXMLがありまして, XSLを使ってリンクになっているHTMLを作りたいのですが, <a href="<xsl:value-of select="./@href">"><xsl:value-of select="./@name"/></a> のような記述をしますと,<が入れ子になっているのでエラーになってしまいます. <xsl:text>で囲って<に置き換えたりしても駄目でした. 一体,どの様にしたら良いのでしょうか?宜しくお願いします. http://medaka.5ch.io/test/read.cgi/php/999654569/231
232: nobodyさん [sage] 04/01/27 19:36 ID:??? >>230 スレ違い。 >>231 xsl:attribute 使え。その疑問が出てくるのは、もう一度 XML と XSLT に関 するキチンとした入門書を通読し直した方が良さげ。 > <a href="<xsl:value-of select="./@href">"><xsl:value-of select="./@name"/></a> 整形式じゃねーしよ。 http://medaka.5ch.io/test/read.cgi/php/999654569/232
233: 231 [sage] 04/01/27 20:03 ID:??? >>232 有難うございます.おっしゃる通り,@ITの記事を読んだだけの厨房です. xsl:attributeでググったらやり方が分かりました. 仕事で使う際は,本を読んで真面目に勉強させて頂きます. 有難うございました. 同じ疑問を持った方の参考に(いないかな〜),以下で可能だと思われます. <xsl:element name="a"> <xsl:attribute name="href"> <xsl:value-of select="./@href"/> </xsl:attribute> <xsl:value-of select="./@name"/> </xsl:element> http://medaka.5ch.io/test/read.cgi/php/999654569/233
234: nobodyさん [sage] 04/01/28 02:23 ID:??? { } が使えるとかって知らないでしょ?マジで。 http://medaka.5ch.io/test/read.cgi/php/999654569/234
235: nobodyさん [sage] 04/01/28 15:19 ID:??? {./@href} で書けるのだが、<a href="..."> みたいな xhtml タグを xslt の中に書かないほうが良いらしい。 <a href="{./@href}"> <xsl:value-of select="./@name"/> </a> http://medaka.5ch.io/test/read.cgi/php/999654569/235
236: nobodyさん [sage] 04/01/28 21:56 ID:??? xmlをxslt使ってhtmlとかに変換して<a href...を作るには、もとのxmlで<a href=...なんて書けない。 235が正しい。 http://medaka.5ch.io/test/read.cgi/php/999654569/236
237: nobodyさん [sage] 04/01/29 01:45 ID:??? 何言ってんだか。一度は仕様書読めよ。 http://medaka.5ch.io/test/read.cgi/php/999654569/237
238: 232 [sage] 04/01/29 13:19 ID:??? 俺の解答不味かったか。{} じゃなく <xsl:attribute/> を教えたのは俺の趣味と Google で検索する時のことを考えてだったんだが、正直スマンかった。 で、>>235-236 の論点が良く分からんのだが、何が言いたいの? http://medaka.5ch.io/test/read.cgi/php/999654569/238
239: nobodyさん [sage] 04/01/29 13:43 ID:??? >>236 ( ゚д゚)ポカーン それはさておき、漏れは {} 使う派。 attributeは、条件(if)によって属性追加する時くらいしか使わない。 多岐分岐(choose〜when)で属性の値を変える場合は、 直前で変数用意して、{} で埋める。 だって、見やすいんだも〜ん http://medaka.5ch.io/test/read.cgi/php/999654569/239
240: nobodyさん [sage] 04/01/29 23:46 ID:??? xmlをxslt使ってhtmlとかに変換して<a href...を作るには、xslで<a href=...なんて書けない。 かな? http://medaka.5ch.io/test/read.cgi/php/999654569/240
241: nobodyさん [sage] 04/01/30 09:31 ID:??? >>240 なんで?(´Д`) http://medaka.5ch.io/test/read.cgi/php/999654569/241
242: nobodyさん [sage] 04/01/30 12:10 ID:??? in : <item name="2ちゃんねる" href="http://www.2ch.net/"/> xsl : <xsl:template match="item"> <a href="{@href}"><xsl:value-of select="@name"/></a> </xsl:template> out : <a href="http://www.2ch.net">2ちゃんねる</a> ってことじゃないのん? http://medaka.5ch.io/test/read.cgi/php/999654569/242
243: nobodyさん [sage] 04/01/30 21:21 ID:??? >>242 え? そんなことできるんだ。知らんかった。 http://medaka.5ch.io/test/read.cgi/php/999654569/243
244: nobodyさん [sage] 04/01/30 21:39 ID:??? >>243 (°Д°)ポカーン http://medaka.5ch.io/test/read.cgi/php/999654569/244
245: nobodyさん [sage] 04/01/30 22:40 ID:??? <xsl:copy-of> で コピーしたノードのタグに、 <hoge xmlns=""> みたいに空欄の名前空間がつくのだが、これはどういう事なのだろうか。 -- hoge.xml -- <?xml version="1.0" encoding="UTF-8" ?> <?xml-stylesheet version="1.0" encoding="UTF-8" type="text/xsl" href="./hoge.xsl" ?> <hoges> hoge is <hoge> HOGE </hoge>. </hoges> -- hoge.xsl -- <?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet version="1.0" xmlns="http://www.w3.org/1999/xhtml" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/hoges"> <xsl:copy-of select="text() | * | @*" /> </xsl:template> </xsl:stylesheet> -- hoge.html -- hoge is <hoge xmlns="">HOGE </hoge>. 目標は、↓なのだが。 -- hoge.html -- hoge is <hoge> HOGE </hoge>. http://medaka.5ch.io/test/read.cgi/php/999654569/245
246: nobodyさん [sage] 04/01/31 01:39 ID:??? 出力をHTMLにしたいみたいだけど、とりあえず xsl:output method="html" とかしてみたら? http://medaka.5ch.io/test/read.cgi/php/999654569/246
メモ帳
(0/65535文字)
上
下
前
次
1-
新
書
関
写
板
覧
索
設
栞
歴
あと 312 レスあります
スレ情報
赤レス抽出
画像レス抽出
歴の未読スレ
AAサムネイル
Google検索
Wikipedia
ぬこの手
ぬこTOP
0.025s