XSL/XSLT (558レス)
XSL/XSLT http://medaka.5ch.io/test/read.cgi/php/999654569/
上
下
前
次
1-
新
通常表示
512バイト分割
レス栞
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.014s