XSL/XSLT (558レス)
XSL/XSLT http://medaka.5ch.io/test/read.cgi/php/999654569/
上
下
前
次
1-
新
通常表示
512バイト分割
レス栞
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
247: ヽ(´ー`)ノ [sage] 04/01/31 12:03 ID:??? >>245 xsltproc(libxslt付属)だったら、望んだ出力になるが。バグじゃねーの? >>246 いや、それは関係ないだろ。 http://medaka.5ch.io/test/read.cgi/php/999654569/247
248: 245 [sage] 04/01/31 15:24 ID:??? う、msxmlのバグかな お騒がせしました。失礼いたします http://medaka.5ch.io/test/read.cgi/php/999654569/248
249: nobodyさん [sage] 04/02/01 01:23 ID:??? JRE1.4.2でもなるよ http://medaka.5ch.io/test/read.cgi/php/999654569/249
250: nobodyさん [sage] 04/02/21 13:19 ID:??? xsltからxsltを出力するときなんかで、{}という文字を含んだ属性を出力したいときにもattribute要素使うな。 一応{'{hoge}'}でいけると思うけどなんか変だし。 http://medaka.5ch.io/test/read.cgi/php/999654569/250
251: nobodyさん [] 04/02/21 19:00 ID:4PYw/lWY >>250 言ってる意味が良く分からないなぁ。 属性名に { } は使えないでしょ。 属性値に { } があっても上とは関係ないし。 http://medaka.5ch.io/test/read.cgi/php/999654569/251
252: nobodyさん [sage] 04/02/22 17:24 ID:??? みなさんXSLの作成は何でやってます? XSLってもともと可読性にかけるし、 IEだとキャッシュ読んだりエラーがわかりにくかったりしてデバッグが激しくし辛いのだが。 http://medaka.5ch.io/test/read.cgi/php/999654569/252
253: nobodyさん [sage] 04/02/22 18:13 ID:??? 可読性に欠けないプログラミング言語ってある? インデントとかコメントとか自分で工夫するもんじゃない? IE じゃなくて、msxsl.exe とか使うのもいいと思うよ。 http://medaka.5ch.io/test/read.cgi/php/999654569/253
254: ヽ(´ー`)ノ [sage] 04/02/22 18:14 ID:??? > みなさんXSLの作成は何でやってます? Emacs 使いなので Emacs で。 > XSLってもともと可読性にかけるし、 書き方が下手なだけだと思うが。 > IEだとキャッシュ読んだりエラーがわかりにくかったりしてデバッグが激しくし辛いのだが。 msxsl.exe http://medaka.5ch.io/test/read.cgi/php/999654569/254
255: nobodyさん [sage] 04/02/22 20:09 ID:??? >>252 Komodo http://medaka.5ch.io/test/read.cgi/php/999654569/255
256: 250 [sage] 04/02/23 13:14 ID:??? >>251 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:axsl="http://www.w3.org/1999/XSL/TransformAlias"> <xsl:namespace-alias stylesheet-prefix="axsl" result-prefix="xsl"/> <xsl:template match="/"> <axsl:stylesheet> <axsl:template match="/"> <foo bar="{'{aaa}'}"/> </axsl:template> </axsl:stylesheet> </xsl:template> </xsl:stylesheet> こういう場合。 今試してみたらxsltproc(Using libxml 20604, libxslt 10102 and libexslt 802)だとunmatched '}'とパースエラーが出て、xalan 2.3.1だと問題無く処理できる。 xsltprocでもattribute要素使えば処理できる。 >>252 xsltはxmlなので読みやすいようにスタイルシートを適用してブラウザで見るのが良いかと。 直接編集できないけど。リアルタイムでスタイルシートを適用してくれるxmlエディタならできるかな? エディタはEmacsでxml-lite-modeを使っている。xsltプロセッサはメインがxsltprocで変な動きをしたときはxalan。 タグの閉じ忘れがチェックできるだけでもだいぶ違うよ。 http://medaka.5ch.io/test/read.cgi/php/999654569/256
257: nobodyさん [] 04/02/25 08:26 ID:Hbu4YFmr XSLTって自分自身を出力するスタイルシートは書ける? http://medaka.5ch.io/test/read.cgi/php/999654569/257
258: nobodyさん [] 04/03/24 22:07 ID:QhqWFZPy xhtml文書をxsltprocで変換したいと思ってるんだけど、 xhtml側のnamespaceの状態よってマッチしたりしなかったりするので困ってる。 ----- test.xsl ----- <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="html"/> </xsl:stylesheet> ----------------- [実行例] $ xsltproc.exe -v test.xsl test.xml 2>&1 | grep xsltProcessOneNode ----- test.xml ----- <?xml version="1.0"?> <html xmlns="http://www.w3.org/1999/xhtml"/> ----------------- xsltProcessOneNode: no template found for / xsltProcessOneNode: no template found for html このようにマッチしない。でも、namespaceを消したり名前を付けたりするとマッチする。 ----- test.xml ----- <?xml version="1.0"?> <html xmlns:xhtml="http://www.w3.org/1999/xhtml"/> ----------------- xsltProcessOneNode: no template found for / xsltProcessOneNode: applying template 'html' for html 何故?また回避策は? #現象が再現できる最小のソースです。validなxhtmlに対しても同様です。 http://medaka.5ch.io/test/read.cgi/php/999654569/258
259: nobodyさん [sage] 04/03/24 22:10 ID:??? 2行目×状態よって○状態によって xsltprocはCygwin版libxslt1.1.2-1です。 $ xsltproc --version Using libxml 20604, libxslt 10102 and libexslt 802 xsltproc was compiled against libxml 20604, libxslt 10102 and libexslt 802 libxslt 10102 was compiled against libxml 20604 libexslt 802 was compiled against libxml 20604 http://medaka.5ch.io/test/read.cgi/php/999654569/259
260: nobodyさん [sage] 04/03/29 11:53 ID:??? namespaceというのは要素の苗字に当たります。 xmlns="http://www.w3.org/1999/xhtml" と指定することは、この要素とその子孫要素の内プレフィックスの付いてないものの苗字は"http://www.w3.org/1999/xhtml"ですよと宣言することで、 xmlns:xhtml="http://www.w3.org/1999/xhtml" と指定することは、この要素とその子孫要素のうちxhtmlというプレフィックスが付いているものの苗字は"http://www.w3.org/1999/xhtml"ですよと宣言することです。 ですから1番目のtest.xmlのhtml要素はhttp://www.w3.org/1999/xhtmlという苗字を持ったhtml要素ということになります。 一方2番目のtest.xmlのhtml要素にはxhtmlというプレフィックスが無いため苗字無しのhtml要素となります。 test.xslでは苗字無しのhtml要素にマッチするようになっているため1番目のtest.xmlにはマッチしませんが2番目のtest.xmlではマッチします。 解決するためにはtest.xslのxsl:template要素にxmlns="http://www.w3.org/1999/xhtml"と宣言を加えるか、 xmlns:xhtml="http://www.w3.org/1999/xhtml"と宣言を加えてxsl:templateのmatch属性を"xhtml:html"とします。 これで苗字付きのhtml要素にマッチするようになります。 http://medaka.5ch.io/test/read.cgi/php/999654569/260
261: nobodyさん [sage] 04/03/29 12:55 ID:??? pc2鯖が消える前の>>258への解答ローカルで持ってるけど上げる? http://medaka.5ch.io/test/read.cgi/php/999654569/261
262: nobodyさん [sage] 04/03/29 13:12 ID:??? 貼っときますね 260 :nobodyさん :sage :04/03/26 13:09 ID:??? ----- test.xsl ----- <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:h="http://www.w3.org/1999/xhtml"> <xsl:template match="/h:html"/> </xsl:stylesheet> ----------------- あるいは ----- test.xsl ----- <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:h="http://www.w3.org/1999/xhtml"> <xsl:template match="/"><xsl:apply-templates select="h:html" /></xsl:template> <xsl:template match="h:html"/> </xsl:stylesheet> ----------------- とかどうですか。 xmlns:h=".." は xmlns=".." にしておいて match="/html" あるいは match="/h:html" などでもいいだろうけど。 http://medaka.5ch.io/test/read.cgi/php/999654569/262
263: nobodyさん [sage] 04/03/29 13:14 ID:??? 続き 261 :nobodyさん :sage :04/03/26 13:27 ID:??? >>260 で、できた!ありがとう! でも、なんでこうなるの? XML側にネームスペースがなかったり、名前付けされてたらマッチして、 デフォルトネームスペースがあるとマッチしない理屈がわかんない。 仕様?バグ?ポインタだけでも教えてもらえるとありがたい。 あと、>>260さんは何で知ってるの?(まさか、これFAQ?) http://medaka.5ch.io/test/read.cgi/php/999654569/263
264: nobodyさん [sage] 04/03/29 13:20 ID:??? 以上削除前の263でした。 262 :260 :sage :04/03/26 14:48 ID:??? >>260 の訂正 >xmlns:h=".." は xmlns=".." にしておいて >match="/html" あるいは match="html" などでもいいだろうけど。 >>261 test.xsl で xmlns:h="http://www.w3.org/1999/xhtml" が無い場合、 match="html" でマッチするのは 名前空間無し + "html" という要素だと思う。 で、XHTML のほうは <html xmlns="http://www.w3.org/1999/xhtml"> ... </html> なってたら、html 要素は内部的には 名前空間 "http://www.w3.org/1999/xhtml" + "html" になってる。 名前空間無し + "html" と 名前空間 "http://www.w3.org/1999/xhtml" + "html" は違ってる。なのでマッチしない。 そこで、>>260 に書いたみたく、XSLT の側でマッチさせる対象を後者の ような名前空間 + "html" なものになるよう指定しなきゃいけない。 <html xmlns:xhtml="http://www.w3.org/1999/xhtml"/> と書いた場合は、<html の html は「名前空間無し + "html"」になる。 プリフィックスで xhtml に "http://www.w3.org/1999/xhtml" を割りあててる から、これはデフォルトプリフィックス使ってる <html そのものには影響しない。 http://medaka.5ch.io/test/read.cgi/php/999654569/264
265: ”削除”後の260 [sage] 04/03/29 18:58 ID:??? (´・ω・`) http://medaka.5ch.io/test/read.cgi/php/999654569/265
266: nobodyさん [] 04/04/02 00:28 ID:I+SOWEa+ ・foo.xml <?xml version="1.0" encoding="utf-8"?> <?xml-stylesheet type="text/xsl" href="foo.xsl"?> <body> <ruby><rb>This</rb><rt>ディス</rt></ruby> <ruby><rb>is</rb><rt>イズ</rt></ruby> <ruby><rb>a</rb><rt>ア</rt></ruby> <ruby><rb>pen</rb><rt>ペン</rt></ruby>! </body> ・foo.xml <?xml version="1.0" encoding="Shift_JIS"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.or/Profiles/XHTML-transitional"> <xsl:output indent="yes" method="html"/><xsl:template match="/"> <html><body> <xsl:for-each select="body"> <xsl:for-each select="ruby"> <xsl:value-of select="rb" /> </xsl:for-each> </xsl:for-each> </body></html> </xsl:template> </xsl:stylesheet> で、 <html xmlns="http://www.w3.or/Profiles/XHTML-transitional"> <body>This is a pen!</body></html> と出力させたいんだけど、 <html xmlns="http://www.w3.or/Profiles/XHTML-transitional"> <body>Thisisapen</body></html> 実際にはこう。どなたか知恵をお貸しください。おながいします。 http://medaka.5ch.io/test/read.cgi/php/999654569/266
267: nobodyさん [sage] 04/04/02 03:16 ID:??? '!'あたりを見るとXSLを理解してないような。 <xsl:template match="/"> <html><body> <xsl:for-each select="(body|.//rb)/text()"> <xsl:choose> <xsl:when test=".='?'"> <xsl:text> </xsl:text> </xsl:when> <xsl:otherwise> <xsl:value-of select="."/> </xsl:otherwise> </xsl:choose> </xsl:for-each> </body></html> </xsl:template> テストしてないので自信はないですが。頭と尻に余計なものがくっつくヨカン。 http://medaka.5ch.io/test/read.cgi/php/999654569/267
268: 267 [sage] 04/04/02 03:21 ID:??? 化けた。スマン。 <xsl:when test=".='&#10;'"> 全角を置き換えて。 http://medaka.5ch.io/test/read.cgi/php/999654569/268
269: 266 [sage] 04/04/02 20:40 ID:??? ありがとうございました。"!"は拾ってくれるようになりました。 <html xmlns="http://www.w3.or/Profiles/XHTML-transitional"><body> Thisisapen! </body></html> しかし、上のように単語間のスペースは拾われないみたいです。 おっしゃるとおりXSLTはまだかじりたてなので、自分でも調べてみます。 http://medaka.5ch.io/test/read.cgi/php/999654569/269
270: nobodyさん [sage] 04/04/02 20:50 ID:??? 自己レスです。xmlのほうのbodyタグに xml:space="preserv" と属性を加えたら期待通りの結果が得られました。 重ね重ねありがとうございました。 http://medaka.5ch.io/test/read.cgi/php/999654569/270
271: 267 [sage] 04/04/02 21:33 ID:??? <xsl:preserve-space>というタグがありますけど… あとxhtmlの識別子が間違ってますよ。 http://medaka.5ch.io/test/read.cgi/php/999654569/271
272: nobodyさん [] 04/04/08 12:47 ID:Pkn49QjT <A> <B><C>○あいう</C></B> <B><C>100</C></B> <B><C>200</C></B> <B><C>○いうえ</C></B> <B><C>50</C></B> </A> を <A> <B> <C>○あいう</C> <D>100</D> <D>200</D> </B> <B> <C>○いうえ</C> <D>50</D> </B> </A> に書き換えたいのですが、xpathで 1. /A/B/Cで○があるもの、もしくは○がないもの 2. 自分の一番近い兄で/A/B/Cで○があるもの というのはどう表記されるでしょうか? http://medaka.5ch.io/test/read.cgi/php/999654569/272
273: nobodyさん [sage] 04/04/08 13:10 ID:??? >>272 よく読んでいないけれど、ツリー構造の変更は XSL ではなくて、 DOM じゃないのか? http://medaka.5ch.io/test/read.cgi/php/999654569/273
274: nobodyさん [sage] 04/04/08 16:06 ID:??? >>272 >1. /A/B/Cで○があるもの、もしくは○がないもの starts-with(.,'○') か これを not() で囲う >2. 自分の一番近い兄で/A/B/Cで○があるもの >というのはどう表記されるでしょうか? preceding::C[starts-with(.,'○')][1] こんなでしょうか。ここから <xsl:template match="/A"> <A> <xsl:apply-templates select="B/C[starts-with(.,'○')]"/> </A> </xsl:template> <xsl:template match="B/C[starts-with(.,'○')]"> <xsl:variable name="val" select="."/> <B> <C><xsl:value-of select="."/></C> <xsl:for-each select="following::C[substring(.,1,1) != '○']"> <xsl:if test="preceding::C[starts-with(.,'○')][1] = $val"> <D><xsl:value-of select="."/></D> </xsl:if> </xsl:for-each> </B> </xsl:template> これでとりあえずできるかと。要素数増えるとfor-each以下が効率悪そうだけ ど。(.,'○')が顔文字にしか見えないのが欠点。 http://medaka.5ch.io/test/read.cgi/php/999654569/274
275: nobodyさん [sage] 04/04/08 18:38 ID:??? >>257 遅レスですが <xsl:copy-of select="document('')/...."/> ってこと?テンプレートとしては使えないけど。使えても意味ないけどね。 http://medaka.5ch.io/test/read.cgi/php/999654569/275
276: nobodyさん [sage] 04/04/09 10:37 ID:??? >>274 ありがとう。 元の処理に教えていただいたコードを入れて動かしたいと思います。 http://medaka.5ch.io/test/read.cgi/php/999654569/276
277: nobodyさん [sage] 04/04/18 17:14 ID:??? >>275 いや、C言語とかだと自分自身を出力するプログラムが書けるんですが http://www.ice.nuie.nagoya-u.ac.jp/~h003149b/lang/quine.html xsltの場合ネームスペースとかの関係で無理なんじゃないかと思って。 でもネームスペースを明示的に指定してやればできるのか? documentで参照するのはアリなのかなぁ。 http://medaka.5ch.io/test/read.cgi/php/999654569/277
278: nobodyさん [sage] 04/04/18 21:38 ID:??? >>277 document('')で自分を参照するのは割と普通に使いますよ。自分は、ですが。 使ってるソースを目にすることもあります。 参照したデータはテンプレートとして使われることはないのでネームスペース は(自分の少ない知識の範囲内では)そんなに問題にならないと思います。た とえば <xsl:template match="/"> <xsl:copy-of select="document('')//xsl:template[@match='/']"/> </xsl:template> これでも無限ループになる事はないです。もちろんこんなの意味ないので、別 のネームスペースを使って設定ファイル的なことをする方が一般的だと思います。 http://medaka.5ch.io/test/read.cgi/php/999654569/278
279: nobodyさん [sage] 04/05/07 01:25 ID:??? XSLTXTって使ってる人いますか? ttps://xsltxt.dev.java.net/ ttp://www.zanthan.com/ajm/xsltxt/index.html とりあえず < とか書かなくていいのがいい。 http://medaka.5ch.io/test/read.cgi/php/999654569/279
280: nobodyさん [sage] 04/05/07 01:26 ID:??? あ、&lt; です↑ http://medaka.5ch.io/test/read.cgi/php/999654569/280
281: nobodyさん [sage] 04/05/09 20:35 ID:??? >>279 > とりあえず < とか書かなくていいのがいい。 まともな XML オーサリングツール使えよ。 http://medaka.5ch.io/test/read.cgi/php/999654569/281
282: nobodyさん [age] 04/05/27 16:04 ID:??? <li a="2300" b="hoge"/> <li a="jiro" b="もっこり"/> <li a="義雄" b="boke"/> といったようなリストがあったとして、 属性b の値が hoge の時だけ 属性a の値を取りたいんですけど、 xpathではどうすればいいのでしょうか? http://medaka.5ch.io/test/read.cgi/php/999654569/282
283: nobodyさん [sage] 04/05/27 19:38 ID:??? >>282 li[@b='hoge']/@a かな。 http://medaka.5ch.io/test/read.cgi/php/999654569/283
284: nobodyさん [age] 04/06/04 12:24 ID:??? <a> <b>bbb</b> <c>ccc</c> </a> こんな感じのものを、「<b>要素が存在すればattributeにbを書き、<b>要素が存在しないまたは<b>要素の中身が空の場合はattributeにcを書く」というふうにしたいのですが、 <xsl:attribute name="foo"> <xsl:choose> <xsl:when test="条件"> <xsl:value-of select="b" /> <xsl:/when> <xsl:otherwise> <xsl:value-of select="c" /> <xsl:/otherwise> </xsl:choose> </xsl:attribute> whenの条件にどのように書けばいいのでしょうか?そもそもchooseは間違っているのでしょうか? http://medaka.5ch.io/test/read.cgi/php/999654569/284
285: nobodyさん [sage] 04/06/04 17:41 ID:??? >>284 test="b and not(b='')" 単に "not(b='')" だけでいいかも。 http://medaka.5ch.io/test/read.cgi/php/999654569/285
286: 284 [sage] 04/06/04 20:42 ID:??? >>285 > test="b and not(b='')" うまくいきました!感謝!! http://medaka.5ch.io/test/read.cgi/php/999654569/286
287: nobodyさん [age] 04/06/10 09:00 ID:??? 1ページの表示件数を10とかに指定して、 続きは<a>で次のページを表示させる…ってことは、 xsltでできるんでしょうか? それともほかのプログラムと組み合わせたほうが賢明なんでしょうか? http://medaka.5ch.io/test/read.cgi/php/999654569/287
288: nobodyさん [sage] 04/06/11 16:14 ID:??? サーバーサイドでやればできる。実際動かしてみたことある。 しかし素直にDOMとか使った方がいいかと。 http://medaka.5ch.io/test/read.cgi/php/999654569/288
289: 287 [sage] 04/06/11 20:00 ID:??? >>288 DOMっすかあ・・・。 最近XMLに興味を持ち始めて、あとPHPも気になりだしたような、 プログラミングなんてまったくできない人間なので。 これから勉強していきたいと思います。ありがとう。 http://medaka.5ch.io/test/read.cgi/php/999654569/289
290: nobodyさん [sage] 04/06/11 21:21 ID:??? 俺も一年くらい前からそんな感じで勉強してます。 http://medaka.5ch.io/test/read.cgi/php/999654569/290
291: nobodyさん [sage] 04/06/14 05:46 ID:??? PHP を使おうとは思うんだが、サーバーで動的生成か、ローカルで静的生成かで迷ってる。 ブログ程度なら静的にすべきなのかな。でも、動的だとコンテントネゴシエーションとかブラウザ振り分けなどの恩恵が……うーむ。 http://medaka.5ch.io/test/read.cgi/php/999654569/291
292: nobodyさん [sage] 04/06/14 06:23 ID:??? blog≠xml blog∩xml=Φ blog≠xslt blog∩xslt=Φ だと思うけど、違うのかな http://medaka.5ch.io/test/read.cgi/php/999654569/292
293: nobodyさん [sage] 04/06/14 06:47 ID:??? >>292 Φ (ファイ) が何を意味するのかは俺には分からんが、>>291 の日本語に混乱していると推測してみた。 PHP で XSL 変換してブログを行おうと思うんだが、クライアントごとに逐一サーバーで動的変換しようか、ローカルで HTML ファイルなどを静的生成しようか迷ってる。 商用サイトなどならともかく、ブログ程度なら静的に行うべきなのかな。 でも、動的だとコンテントネゴシエーションとかブラウザ振り分けなどの恩恵が……うーむ。 http://medaka.5ch.io/test/read.cgi/php/999654569/293
294: nobodyさん [sage] 04/06/15 10:23 ID:??? Φは空集合やろ blog∩xslt = Lenyaに附属してたblogのサンプル だと思うが、出来はいまいちだった http://medaka.5ch.io/test/read.cgi/php/999654569/294
295: nobodyさん [] 04/06/23 11:34 ID:1zBprzUE <item id="a"> <created>2004-01-03T00:00</created> <modified>2004-01-04T00:00</modified> </item> <item id="b"> <created>2004-01-02T00:00</created> <modified>2004-03-01T00:00</modified> </item> <item id="c"> <created>2004-02-01T00:00</created> </item> これら item 要素の子 created・modified 両要素の内容を選別して親の item 要素を新しい順 (b・c・a) に並べ替えたいのですが、例えば以下のように xsl:sort 要素を使ってもうまくできません。 <xsl:apply-templates select="item"> <xsl:sort select="created or modified" order="descending"/> </xsl:apply-templates> 助けてくださいお願いします。 http://medaka.5ch.io/test/read.cgi/php/999654569/295
296: nobodyさん [sage] 04/06/23 14:51 ID:??? >>295 "or"は論理演算子だからここで使っても意味ないよ(T/Fが返ってくる)。 select="created[not(../modified)] | modified" でどう? http://medaka.5ch.io/test/read.cgi/php/999654569/296
297: 295 [sage] 04/06/23 14:59 ID:??? >>296 ありがとうございます。出来ました。 http://medaka.5ch.io/test/read.cgi/php/999654569/297
298: nobodyさん [sage] 04/06/25 16:19 ID:??? xsl:copy-of で属性値を取得できません。 xsl:value-of なら属性値を取得できました。 -- xml -- <a href="http://example.org/"> example </a> -- xsl -- <xsl:copy-of select="/a/@href" /> <br /> <xsl:value-of select="/a/@href" /> <br /> -- output -- <br /> http://example.org/ <br /> -- xsl:copy-of を使用して属性値を取得する方法をご存知の方がいらっしゃいましたら、 その方法をお教え下さいませ。 http://medaka.5ch.io/test/read.cgi/php/999654569/298
299: nobodyさん [sage] 04/06/26 05:29 ID:??? それだと copy-of でコピーされるのは属性ノードだからそのままでは出力で きない。どうしてもしたいならこんな感じで、 <xsl:copy-of select="string(/a/@href)"/> 非ノードにしたものを渡せばよい。でも value-of のほうが適切。 http://medaka.5ch.io/test/read.cgi/php/999654569/299
300: 298 [sage] 04/06/26 21:02 ID:??? value-of を使うことに致します。ありがとう http://medaka.5ch.io/test/read.cgi/php/999654569/300
301: nobodyさん [sage] 04/07/03 03:02 ID:??? 次のようなXMLデータがあるとき、 name="foo"の前後のitemのname属性値を表示するようなXSLTはどう書けばいいんでしょうか? <list> <item name="hoge" /> <item name="foo" /> <item name="bar"/> </list> http://medaka.5ch.io/test/read.cgi/php/999654569/301
302: nobodyさん [sage] 04/07/03 04:31 ID:??? <xsl:value-of select="item[@name='foo']/preceding-sibling::item[1]/@name"/> <xsl:value-of select="item[@name='foo']/following-sibling::item[1]/@name"/> かな。試してないけど。 http://medaka.5ch.io/test/read.cgi/php/999654569/302
303: 301 [sage] 04/07/04 00:41 ID:??? >>301 それで成功しました。 ありがとうございます。 http://medaka.5ch.io/test/read.cgi/php/999654569/303
304: nobodyさん [] 04/08/25 17:25 ID:ly9L2Z7D <root> <mage> <mage> <take> <toge> みたいな構造になっているXMLファイルがあって(上では閉じタグ省略)、 いまrootから何階層目にいるのかを知るにはどうしたら良い? http://medaka.5ch.io/test/read.cgi/php/999654569/304
305: nobodyさん [sage] 04/08/25 18:19 ID:??? >>304 count(ancestor::node()) でどうよ? http://medaka.5ch.io/test/read.cgi/php/999654569/305
306: nobodyさん [] 04/09/06 20:13 ID:koFx6bH6 天気予報は既存の配信ビジネスを守るためにRSS配信できない http://neta.ywcafe.net/000339.html 国民の税金で気象データの収集・解析までしておきながら、 気象庁の官僚の天下り先である ・財団法人 気象業務支援センター ・財団法人 日本気象協会 の利権保護の為、未だRSS配信が拒まれているのだ。 将来的に行われるであろう地震予知の情報も、有料で国民に販売するつもりだろうか? http://medaka.5ch.io/test/read.cgi/php/999654569/306
307: nobodyさん [sage] 04/09/07 09:26 ID:??? 二重徴税で叩けないのかな。 http://medaka.5ch.io/test/read.cgi/php/999654569/307
308: nobodyさん [sage] 04/09/07 09:29 ID:??? >>306 是非はともかくそんなとこのソースを元に騒いでんの?w http://medaka.5ch.io/test/read.cgi/php/999654569/308
309: nobodyさん [sage] 04/09/07 14:14 ID:??? XMLのスレにマルチしまくってるから放置しとけ http://medaka.5ch.io/test/read.cgi/php/999654569/309
310: nobodyさん [sage] 04/09/07 17:02 ID:??? >>307 じゃあまずガソリンスタンドをたたいてくれ。 http://medaka.5ch.io/test/read.cgi/php/999654569/310
311: nobodyさん [sage] 04/09/07 21:05 ID:??? 気象庁職員必死だな(w http://medaka.5ch.io/test/read.cgi/php/999654569/311
312: nobodyさん [sage] 04/09/08 11:32 ID:??? 306,307 は気象庁を、 310 はガソリンを、 308,311 は住民を、 各自、自由に叩いてください。 313 は XSL/XSLT ネタ、よろしく。 http://medaka.5ch.io/test/read.cgi/php/999654569/312
313: nobodyさん [sage] 04/09/09 02:59 ID:??? 気象庁住民はガソリンで逝ってよし。 http://medaka.5ch.io/test/read.cgi/php/999654569/313
314: nobodyさん [sage] 04/09/09 09:57 ID:??? XSL/XSLT/ネタではなく XSL/XSLTのネタよろしく。 http://medaka.5ch.io/test/read.cgi/php/999654569/314
315: nobodyさん [] 04/09/24 05:09:23 ID:/pWgzu1/ <a id="a0"> <b id="b0"> <c>foo0</c> <c>bar0</c> </b> <b id="b1"> <c>foo1</c> <c>bar1</c> </b> </a> のようなデータから、<c>の値を2つ指定して最初に出てくる共通の親要素を 見つけるにはどうすればよいでしょうか? 例えば、"foo0"と"bar0"なら "b0"、"foo0"と"foo1"なら"a0"がほしいです。 共通の親をすべてならなんとかなるのですが、 その中で最初にマッチする親だとさっぱりわかりません。 よろしくおねがいします。 http://medaka.5ch.io/test/read.cgi/php/999654569/315
316: nobodyさん [sage] 04/09/25 10:50:09 ID:??? >>315 (descendant::c[. = 'foo0']/ancestor::*[./descendant::c[. = 'bar1']])[last()]/@id http://medaka.5ch.io/test/read.cgi/php/999654569/316
317: 316 [sage] 04/09/26 08:08:17 ID:??? 後で考えたら、えらい無駄な事をしてるな、と。 /descendant::c[self::node() = 'foo0']/ancestor::*[descendant::c = 'foo1'][position() = 1] これでも、共通且つ最初にマッチする先祖を得られると思う。 http://medaka.5ch.io/test/read.cgi/php/999654569/317
318: 315 [sage] 04/09/27 04:31:18 ID:??? >>316 ありがとうございます。いけそうです。 再帰ばっかり考えてました。 自分のXPath能力の無さに(´・ω・`)ショボーン http://medaka.5ch.io/test/read.cgi/php/999654569/318
319: nobodyさん [sage] 04/09/28 17:39:48 ID:??? 質問です。 XSLT で <a href="javascript:foo('bar')">...</a> のようなタグを生成したいのですが、 引用符のエスケープの仕方がよくわかりません。ご存知の方、ご回答をお願いいたします。 現在はこんなコードを書いてます (エラーになります) <a href="{concat('javascript:foo(', ''', @bar, ''', ')')}"> http://medaka.5ch.io/test/read.cgi/php/999654569/319
320: 319 [sage] 04/09/28 17:41:28 ID:??? >>319 化けてしまいましたが、''' のところは '&apos;' です。 http://medaka.5ch.io/test/read.cgi/php/999654569/320
321: 319 [sage] 04/09/28 18:03:41 ID:??? >>319 <xsl:attibute> を使えばいいのですね。自己解決しますた。お騒がせしました。 http://medaka.5ch.io/test/read.cgi/php/999654569/321
322: nobodyさん [sage] 04/09/28 20:00:16 ID:??? こういう事ですね? <xsl:element name="a"> <xsl:attribute name="href">javascript:foo(&apos;bar&apos;)</xsl:attribute> <xsl:apply-templates /> </xsl:element> コピペするならこっち <xsl:element name="a"> <xsl:attribute name="href">javascript:foo('bar')</xsl:attribute> <xsl:apply-templates /> </xsl:element> アンカー・テキスト不変なら、こっち <xsl:element name="a"> <xsl:attribute name="href">javascript:foo('bar')</xsl:attribute> アンカー・テキスト </xsl:element> http://medaka.5ch.io/test/read.cgi/php/999654569/322
323: nobodyさん [sage] 04/10/11 13:28:18 ID:??? XSLT Standard Library ttp://xsltsl.sourceforge.net/ exsltみたいなライブラリ集だけど、こっちの方が実用的? http://medaka.5ch.io/test/read.cgi/php/999654569/323
324: nobodyさん [] 04/10/14 23:53:23 ID:DOJgSO2G XML SchemaからXSLTの雛形というかスケルトンというか 土台を出力してくれるようなツールって無いでしょうか? フルスクラッチで作るの、面倒じゃないですか? http://medaka.5ch.io/test/read.cgi/php/999654569/324
325: nobodyさん [sage] 04/10/15 00:48:57 ID:??? >>324 スレ違いか http://pc5.2ch.net/test/read.cgi/hp/1057198990/ http://medaka.5ch.io/test/read.cgi/php/999654569/325
326: nobodyさん [sage] 04/12/06 00:30:36 ID:??? data1.xmlというファイルがあって中にxslファイルの参照先も書いてあるとします。 <xml... <xslt:sheet1.xsl..... <DataList> <Data ID="0"> <String>データ0</String> </Data> <Data ID="0"> <String>データ0</String> </Data> <Data ID="0"> <String>データ0</String> </Data> </DataList> このdata1.xmlファイルをdata1.xml?id=0みたいな呼び出し方をしてxslファイルにid=0という値を渡す方法ってあるのでしょうか? http://medaka.5ch.io/test/read.cgi/php/999654569/326
327: nobodyさん [sage] 04/12/06 15:30:17 ID:??? 何言いたいんだかようわからん http://medaka.5ch.io/test/read.cgi/php/999654569/327
328: nobodyさん [] 04/12/06 15:34:45 ID:jrlDRA4f URLを打ち込むときに data1.xml?id=0と打ち込み、ID=0の商品に関する情報だけを 表示したいんです。 URLで打ち込んだデータをXSL内の変数に取り込みたいのです。 現在だと、hrefつかってもIDの数だけxmlファイルを作成しないと いけなくなってしまうんです。 http://medaka.5ch.io/test/read.cgi/php/999654569/328
329: nobodyさん [sage] 04/12/23 23:41:54 ID:??? >>328 今更ながら、xsltで全て作成してjavascriptでlocation.queryから引数受け取ってwindowのロード時に違うノードサクージョ http://medaka.5ch.io/test/read.cgi/php/999654569/329
330: nobodyさん [sage] 05/01/08 15:33:14 ID:??? すいません質問があります。 MSXSLを用いて変換を行おうとしているのですが コマンドを打ち込んだときに 必要な属性'{http://www.w3.org/1999/XSL/Transform}version' が見つかりません という変なエラーメッセージが出てしまいます。これはどうすればいいんでしょうか? http://medaka.5ch.io/test/read.cgi/php/999654569/330
331: nobodyさん [sage] 05/01/08 17:10:58 ID:??? 330ですが 解決しちゃいました どうもです http://medaka.5ch.io/test/read.cgi/php/999654569/331
332: nobodyさん [sage] 05/01/10 19:16:25 ID:??? すみませんが誰かご教授下さい。 (マルチポストで申し訳ありません) XMLのあるタグの属性が同じレベルのタグの属性とダブっっている時、 変換後にその属性のダブった部分を除きながら属性を並べたい場合は どうすればよいでしょうか? 例えば xml <a> <ele id="1"/> <ele id="2"/> <ele id="2"/> <ele id="3"/> <ele id="4"/> <ele id="4"/> <ele id="4"/> <ele id="5"/> </a> を変換して 1 2 3 4 5 にするようなXSLを教えていただきたいのです。 よろしくお願いします。 http://medaka.5ch.io/test/read.cgi/php/999654569/332
333: nobodyさん [sage] 05/01/10 19:48:07 ID:??? アホか。マルチポストに返答するわけ無いだろ。 http://medaka.5ch.io/test/read.cgi/php/999654569/333
334: nobodyさん [] 05/01/22 19:16:33 ID:WsL3wQoU <xsl:stylesheet xmlns:xsl="http://www.w3.org/(ry xmlns:aws="http://abc.com/" exclude-result-prefixes="human"> <xsl:for-each select="people/person/age"> ここで別のXMLを取ってくる <xsl:apply-templates select="human:hobbies/human:hoby" /> </xsl:for-each> <xsl:template match="human:hobby"> http://medaka.5ch.io/test/read.cgi/php/999654569/334
335: 334 [] 05/01/22 19:17:52 ID:WsL3wQoU ああっ、途中で送ってしまった… orz >>334のようにやると下のテンプレートの中身へ行かない?ようなのですが どこに問題があるのでしょう? http://medaka.5ch.io/test/read.cgi/php/999654569/335
336: nobodyさん [sage] 05/01/24 03:30:34 ID:??? >>332 もう解決してるのかもしれんが //ele[not(@id=following-sibling::node()/@id)]/@id とかでどうすか? http://medaka.5ch.io/test/read.cgi/php/999654569/336
メモ帳
(0/65535文字)
上
下
前
次
1-
新
書
関
写
板
覧
索
設
栞
歴
あと 222 レスあります
スレ情報
赤レス抽出
画像レス抽出
歴の未読スレ
AAサムネイル
Google検索
Wikipedia
ぬこの手
ぬこTOP
0.015s