XMLをCSVへ変換する方法とaidの取得方法

このQ&Aのポイント
  • XMLをCSVへ変換する方法について説明します。また、aidを取得するためのXSLの記述方法も解説します。
  • XMLをCSVへ変換する際に必要なXSLの記述方法と、aidを取得する方法について詳しく説明します。
  • XMLをCSVへ変換する方法と、aidを取得するためのXSLの記述方法について解説します。必要な情報を抽出するためのレイアウトも紹介します。
回答を見る
  • ベストアンサー

XMLをCSVへ変換でほしい情報を取得したい

XMLからcsvへの変換 下記のXMLのフィールドの項目をxslを使い、msxsl.exe経由で、csvへ変換をしたいのです。 ユーザーデータ部分は抽出可能ですが、aidを抽出する方法がわかりません。 どなたかご教示のほど、お願いいたします。 ■XML <?xml version="1.0" encoding="shift_jis"?> <状況 aid="555"> <ユーザデータ uid="0001"> <氏名>吉野家 太郎</氏名> <ID>123456</ID> <種別>一般</種別> <率>100</率> <最終更新>2012/02/16 15:20:58</最終更新> </ユーザデータ> <ユーザデータ uid="0002"> <氏名>吉野家 次郎</氏名> <ID>123457</ID> <種別>一般</種別> <率>10</率> <最終更新>2012/03/16 15:20:58</最終更新> </ユーザデータ> </状況> ■xsl  ユーザーデータ取得用 <?xml version="1.0" encoding="Shift_JIS"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > <xsl:output method="text" encoding="Shift_JIS" /> <xsl:template match="/">uid,氏名,ID,種別,率,最終更新 <xsl:apply-templates select="/状況/ユーザデータ"/> </xsl:template> <xsl:template match="ユーザデータ"> <xsl:value-of select="@uid" /><xsl:text>,</xsl:text> <xsl:value-of select="氏名" /><xsl:text>,</xsl:text> <xsl:value-of select="ID" /><xsl:text>,</xsl:text> <xsl:value-of select="種別" /><xsl:text>,</xsl:text> <xsl:value-of select="率" /><xsl:text>,</xsl:text> <xsl:value-of select="最終更新" /><xsl:text> </xsl:text> </xsl:template> </xsl:stylesheet> aidを取得するにはどのようなXSLを書けばよいのでしょうか? 抽出時のレイアウト aid,uid,氏名,ID,種別,率,最終更新 よろしくお願いいたします。

  • XML
  • 回答数2
  • ありがとう数1

質問者が選んだベストアンサー

  • ベストアンサー
noname#152572
noname#152572
回答No.2

改行が<xsl:value-of select...> の前にある(複数行で編集・保存している)からでしょう。 改行の影響を無くすには、見にくいでしょうが影響のあるであろう改行を除いて一行にXSL ファイルを直す必要があります。この場合、<xsl:template> タグ内は改行がそのまま影響する事になります。 #表示中は改行・段落表示され、保存すると無改行になる編集ソフトがあると便利ですけどね(フリーであるかな?)

その他の回答 (1)

noname#152572
noname#152572
回答No.1

ユーザデータタグよりも上位に位置する状況タグのaid 属性値を、<xsl:template match="ユーザデータ">で表示したいということですね? <xsl:value-of select="../@aid"/> でいけません? #深夜、眠いので未検証・・・すまぬ

origami060506
質問者

お礼

回答ありがとうございます。 試しました。 表示できました。 本当にありがとうございます。 助かりました。

origami060506
質問者

補足

試したところ、aid属性値に2桁の空白がどうしても入ります。 ヘダー情報を「aid,uid,氏名,ID,種別,率,最終更新」を書くのを やめると明細の空白はなくなりました。 最終行だけ2桁の空白が残ってしまいます。 これを除去したいです。 もう少し調べてみますが、 なにかヒントなどの助言をいただければ幸いです。

関連するQ&A

  • IEのmsxmlでxmlをcsvに変換

    現在IEにくっついているmsxmlでxmlファイルをcsvに変換させるxslを作成しています。 msxmlでもmsxml3でも動くようなxslファイルを作成したいので ワーキングドラフト仕様のxslの記述を使用しようと思い下記のようなXMLとxslを作成しました <?xml version="1.0" encoding="Shift_JIS"?> <?xml-stylesheet type="text/xsl" href="CSV.XSL"?> <root> <data> <record> <aaaa>1234</aaaa> <bbbb>5678</bbbb> <cccc>9abc</cccc> <dummy name="ENDRECORD"></dummy> </record> <record> <aaaa>1122</aaaa> <bbbb>3344</bbbb> <cccc>5566</cccc> <dummy name="ENDRECORD"></dummy> </record> </data> </root> xslのposition()が使えないので xmlに <dummy name="ENDRECORD"></dummy> を追加して xslで一件分のデータの終わりを認識させています -csv.xsl- <?xml version="1.0" encoding="Shift_JIS"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl" version="1.0"> <xsl:template match="/"> <xsl:apply-templates select="root/data/record"/> </xsl:template> <xsl:template match="root/data/record"> <xsl:for-each select="*"> <xsl:choose> <xsl:when test="./@name[(.='ENDRECORD')]">&#xA;</xsl:when> <xsl:otherwise><xsl:value-of select="."/>,</xsl:otherwise> </xsl:choose> </xsl:for-each> </xsl:template> </xsl:stylesheet> しかし、csvのカンマ編集が以下のようになってしまいます。 1234,5678,9abc, ←最後にカンマが残ってしまう 1122,3344,5566, どなたかワーキングドラフト仕様でも勧告後の仕様でも動くような、csvに変換するxslを作成された方はいませんでしょうか。

    • ベストアンサー
    • XML
  • XMLをXSLを使いHTMLに変換したいのですが・・・・

    あるXML形式のXSL用に次のようにスタイルシートを作成致しました。(例) <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="html" version="4.01" encoding="UTF-8" indent="yes" /> <xsl:template match="/"> <html lang="ja"> <head> <title>○○情報</title> </head> <body><xsl:apply-templates select="ProductInfo"/></body> </html> </xsl:template> <xsl:template match="Responce/Details"/> <h2><xsl:value-of select="Hid"/></h2> <h2><xsl:value-of select="TotalItems"/></h2> <h2><xsl:value-of select="TotalPages"/></h2> <h3><xsl:value-of select="ItemID"/></h3> <h3><xsl:value-of select="ShopID"/></h3> <h3><xsl:value-of select="ProductName"/></h3> <h3><xsl:value-of select="Price"/></h3> <h3><xsl:value-of select="ImageUrlSmall"/></h3> <h3><xsl:value-of select="ImageUrlMedium"/></h3> <h3><xsl:value-of select="mageUrlLarge"/></h3> <h3><xsl:value-of select="URL"/></h3> <h3><xsl:value-of select="MobileURL"/></h3> <h3><xsl:value-of select="Manufacture"/></h3> <h3><xsl:value-of select="Availability"/></h3> <h3><xsl:value-of select="Stock"/></h3> <h3><xsl:value-of select="StockInfinity"/></h3> <h3><xsl:value-of select="ItemDetail"/></h3> <h3><xsl:value-of select="SalesStatus"/></h3> <h3><xsl:value-of select="CategoryID"/></h3> </xsl:template> </xsl:stylesheet> とスタイルシートを作成いたしました。 変換するHMLは <?xml version="1.0" encoding="UTF-8" ?> <?xml-stylesheet type="text/xsl" href="○○.xsl"?> - <ProductInfo> - <Responce> <Hid>○○○○</Hid> <TotalItems>○○○○</TotalItems> <TotalPages>○○○○</TotalPages> - <Details> <ItemID>○○○○</ItemID> <ShopID>○○○○</ShopID> <ProductName>○○○○</ProductName> <Price>○○○○</Price> <Manufacture>○○○○</Manufacture> <Availability>○○○○</Availability> <Stock>0○○○○</Stock> <StockInfinity>○○○○</StockInfinity> <ItemDetail>○○○○</ItemDetail> <SalesStatus>○○○○</SalesStatus> <CategoryID>○○○○</CategoryID> </Details> </Responce> </ProductInfo> 以下<Details>のみ複数繰り返しされます。 この通りに作成したのですが、XMLファイルをウインドウに表示しようとしてもエラーが報告されます。 XSLに繰り返し用のタグを入れても、まったく表示されません。 ちなみにIE7を使用しています。 もし間違っている箇所が分かる方がいらっしゃいましたら、教えていただけませんか? よろしくお願いいたします。

    • ベストアンサー
    • XML
  • XMLからcsvへの変換

    下記のXMLのフィールドの項目を xslを使い、msxsl.exe経由で、csvへ変換をしたいのですが、 各field nameを抽出するのがうまくいきません。 copy condition=の箇所は必要ありません。 どなたかご教示のほど、お願いいたします。 ■XML <?xml version="1.0" encoding="UTF-8"?> <exportData> <Book id="id"> <field name="keywords"></field> <field name="listName"></field> <field name="publisher"></field> <field name="publishDate"></field> <field name="illustrators"></field> <field name="isbn"></field> <field name="length"></field> <field name="id"></field> <field name="series"></field> <field name="authors"></field> <field name="title"></field> <field name="summary"></field> <field name="format"></field> <field name="genre"></field> <field name="coverImage"></field> <field name="List Price"></field> <field name="URL"> </field> <field name="Current Value"></field> <field name="isbn13"></field> <copy condition="" dateAcquired="" location="Bookshelf" owner="" presentValue="" source=""> </copy> </Book> ■xsl <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="text" encoding="UTF-8"/> <xsl:template match="/">keywords,listName,publisher,publishDate,illustrators,isbn,length,id,series,authors,title,summary,format,genre,coverImage,URL,CurrentValue,isbn13 <xsl:apply-templates select="//Book"/> </xsl:template> <xsl:template match="Book"> <xsl:call-template name="keywords"/>,<xsl:call-template name="listName"/>,<xsl:call-template name="publisher"/>,<xsl:call-template name="publishDate"/>,<xsl:call-template name="illustrators"/>,<xsl:call-template name="isbn"/>,<xsl:call-template name="length"/>,<xsl:call-template name="id"/>,<xsl:call-template name="series"/>,<xsl:call-template name="authors"/>,<xsl:call-template name="title"/>,<xsl:call-template name="summary"/>,<xsl:call-template name="format"/>,<xsl:call-template name="genre"/>,<xsl:call-template name="coverImage"/>,<xsl:call-template name="URL"/>,<xsl:call-template name="CurrentValue"/>,<xsl:call-template name="isbn13"/><xsl:text> </xsl:text> </xsl:template> </xsl:stylesheet> よろしくお願いいたします。

    • ベストアンサー
    • XML
  • xml→htmlへの変換&ページ分割したい

    まず、下記のxml、xslによりhtmlページを出力しています。 ■test.xml <?xml version="1.0" encoding="UTF-8"?> <all> <index file_id="a"> <product file_id="a-01"> <yoso>ああああああああああああああああ</yoso> </product> <product file_id="a-02"> <yoso>いいいいいいいいいいいいいいいい</yoso> </product> <product file_id="a-03"> <yoso>うううううううううううううううう</yoso> </product> <product file_id="a-04"> <yoso>ああああああああああああああああ</yoso> </product> <product file_id="a-05"> <yoso>いいいいいいいいいいいいいいいい</yoso> </product> <product file_id="a-06"> <yoso>うううううううううううううううう</yoso> </product> </index> <index file_id="b"> <product file_id="b-01"> <yoso>ああああああああああああああああ</yoso> </product> <product file_id="b-02"> <yoso>いいいいいいいいいいいいいいいい</yoso> </product> <product file_id="b-03"> <yoso>うううううううううううううううう</yoso> </product> <product file_id="b-04"> <yoso>うううううううううううううううう</yoso> </product> </index> <index file_id="c"> <product file_id="c-01"> <yoso>ああああああああああああああああ</yoso> </product> <product file_id="c-02"> <yoso>いいいいいいいいいいいいいいいい</yoso> </product> <product file_id="c-03"> <yoso>うううううううううううううううう</yoso> </product> </index> </all> ■ind.xsl <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml" version="1.0" xmlns:redirect="org.apache.xalan.xslt.extensions.Redirect" extension-element-prefixes="redirect"> <xsl:output method="html" encoding="UTF-8"/> <xsl:template match="index"> <!-- 出力ファイル名 --> <xsl:variable name="filename" select="concat('html/',@file_id, '/index.html')"/> <!-- 出力開始 --> <redirect:open select="$filename"/> <redirect:write select="$filename"> <html> <head> <title><xsl:value-of select="@file_id"/></title> </head> <body> <h1><xsl:value-of select="@file_id"/></h1> <xsl:apply-templates /> </body> </html> </redirect:write> <redirect:close select="$filename"/> <!-- 変換報告 --> <xsl:value-of select="concat('『',$filename,'』変換完了')"/> </xsl:template> <xsl:template match="product"> <a> <xsl:attribute name="href"> <xsl:value-of select="concat(@file_id,'.html')" /> </xsl:attribute> <xsl:value-of select="@file_id" /> </a><br /> </xsl:template> </xsl:stylesheet> ■環境 ・xalan-j_2_7_1 ・j2sdk1.4.2_16 ・windowsxp コマンドプロンプトにより下記を実行すると java org.apache.xalan.xslt.Process -in test.xml -xsl ind.xsl html/a/index.html html/b/index.html html/c/index.html が出力されます。 つまりは各カテゴリ(a,b,c)のproduct要素をまとめた インデックスページが出力されます。 ここまでが現状です。 やりたいのは以下です。 上記だとproductの数にかかわらず1ページのindex.htmlに 出力されます。 test.xmlは数が少ないのでいいですが、 仮に1000個あった場合、どんでもないことになってしまうので、 ページ分割をしたいと思っています。(< 1 2 3 4 > みたいな!) ですが、何をどうしたらよいのか皆目見当が付きません。 1ページを10個までとしてそれ以上は次ページに出力みたいなことはできるのでしょうか。 html/a/index.html html/a/index2.html html/a/index3.htmlみたいにです。。。 上記のxslだとmatchするtemplates(index)は3つだけなので、 xalanが書き出すのは3ぺーじだけです。 この書き出す回数をたとえばcount(product div 10)とかにできれば、 なにかみえてきそうなきもするんですが、、、、 長々と申し訳ありませんが、 ご協力お願いします。

    • ベストアンサー
    • XML
  • XMLの実体参照とXSLT

    次のようなXMLファイルをXSLTで処理したいのですが、&baseの部分がうまく表示できません。 どのようにしたら表示できるでしょうか? ■a.xml <?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/xsl" href="a.xsl"?> <!DOCTYPE test [ <!ELEMENT name (#PCDATA)> <!ENTITY base SYSTEM "base.xml"> ]> <test> <name>abc</name> &base; </test> ■base.xml <?xml version="1.0" encoding="UTF-8"?> <base>base</base> ■a.xsl <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" encoding="UTF-8" /> <xsl:template match="/"> <xsl:apply-templates select="test" /> <xsl:apply-templates select="base" /> </xsl:template> <xsl:template match="test"> name:<xsl:value-of select="name" /> </xsl:template> <xsl:template match="base"> base:<xsl:value-of select="base" /> </xsl:template> </xsl:stylesheet> □結果 name:abc ※base.xmlの内容を表示できない

    • ベストアンサー
    • XML
  • xslのdocument関数で読込んだ2つのxmlをxsl:sortしたい

    次のXSLで動作させています。 <?xml version="1.0" encoding="Shift_JIS"?> <xsl:stylesheet xml:space="default" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema"> <xsl:output method="text" /> <xsl:template match="/"> <xsl:for-each select="document('取り込むXMLファイル')//z:row"> <xsl:value-of select="@取り出したい属性の名前" /> </xsl:for-each> <xsl:for-each select="//z:row"> <xsl:value-of select="@取り出したい属性の名前" /> </xsl:for-each> </xsl:template> </xsl:stylesheet> ここまでは出来たのですが、xsl:sortでまとめてsortするにはどうすればいいのでしょうか?

    • ベストアンサー
    • XML
  • XML/XSLでテンプレートの適用がうまくいかない

    同じツリーの深さで異なる要素名のノードがあるXMLだと期待通りにテンプレートが適用できない という問題に付き当たっています。 例えば    / +------+ poem  poem のような構成だとmatch=poem、value-of select="text"などで各poemの歌詞を表示させることが できます。 一方、以下の構成で同じ事をやろうとすると各poemの歌詞に加えてyearのnumのValueまで 列挙されてしまいます。poemの中身だけ出すにはどうすればよいでしょうか? 以下に例を書きます。     / +--------------+ list         year +------+      +----+ poem poem    Num Num 例えば以下のURLなどを参照してやっております。 http://www6.airnet.ne.jp/manyo/xml/xslt/step15.html XSLはこんな感じです。 <xsl:template match="/"> <xsl:apply-templates /> </xsl:template> <xsl:template match="poem"> <tr> <td><xsl:value-of select="poet" /></td> <td><xsl:value-of select="yomi" /></td> </tr> <br /> </xsl:template> 手持ちのXMLを変換したく、その勉強のため上記のような構成のXMLを扱う方法を 知りたいと思っています。 よろしくお願いします。

    • 締切済み
    • XML
  • XSL内でJavaScriptを記述し、JavaScript内でXMLデータを取得するには・・・

    大変困っていますのでよろしくお願いします。 XSLのファイル内でJavaScriptを記述し、JavaScriptでxmlの要素を取得操作したいのですが、とり方がわかりません。 ご教授のほどをよろしくお願いします。 ================================================================== sample.xsl ------------------------------------------------------------------ <?xml version="1.0" encoding="Shift_JIS"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <html> <head> <title>XML: 基本サンプル</title> </head> <body> <p align="center">サンプル</p> <xsl:apply-templates select="information/value/applicationinfo" /> </body> </html> </xsl:template> <xsl:template match="value/applicationinfo"> <Script Language = "JavaScript"> <xsl:comment> <![CDATA[ document.write("<xsl:value-of select=\"componentname\" />"); ]]> </xsl:comment> </Script> <table border="1"> <tr> <td><xsl:value-of select="componentname" /></td> </tr> </table> </xsl:template> </xsl:stylesheet> ================================================================== 下のテーブルでは要素を表示することはできます。 このやり方では駄目なのでしょうか?

    • ベストアンサー
    • XML
  • xml+xslでの変換内容をtextareaへ

    お世話になります。 xml+xslでhtmlに変換する際、その変換内容をtextareaにも表示させるようにしたいのです。 使用ブラウザ:FireFox。現状はFirebugでDOMツリーを手動で参照してる状況です。 現在は、ノードをtextareaに表示しようとすると[object DocumentFragment]とだけ出てしまい、DocumentFragmentという概念あることは分かり、色々調べcreateElement()やcreateTextNode()など、その他思いつく限りの事でテストしてみてるのですが、どうにもノードをHTMLタグとしてtextareaに表示させる事が出来ません。 以下にポイントとなるソースを掲示しますので、どなた様か、お助け願えませんでしょうか --test.html---- <html><head> <meta content="text/html; charset=utf8" http-equiv="content-type"> <title>JS+xslt</title> <script type="text/javascript"> function tramsformlists(xmlFile, xslFile, resultNodeID){ var xml, xslt, newDoc; if(document.all){ xml = new ActiveXObject("Microsoft.XMLDOM"); xslt = new ActiveXObject("Microsoft.XMLDOM"); }else { xml = document.implementation.createDocument("", "", null); xslt = document.implementation.createDocument("", "", null); } xml.async = false; xslt.async = false; xml.load(xmlFile); xslt.load(xslFile); if(document.all){ document.getElementById(resultNodeID).innerHTML = xml.transformNode(xslt); }else { var xsltp = new XSLTProcessor(); xsltp.importStylesheet(xslt); newDoc = xsltp.transformToFragment(xml, window.document); var df = document.createDocumentFragment(); cloneDoc= newDoc.cloneNode(true); document.getElementById("Div"+resultNodeID).innerHTML = ""; document.getElementById("Div"+resultNodeID).appendChild(newDoc); t = document.msg_form.TextareaTest.value; document.msg_form.TextareaTest.value =t + df.appendChild(cloneDoc); } } </script> </head><body> <form name="msg_form"> <ul> <li> <input type="button" value="Menu" onclick="tramsformlists('test0.xml','test0.xsl','Test')"><br> <div id="DivTest"></div> <textarea cols="50" rows="10" id="TextareaTest">あああああああ</textarea> </li> </ul> </form> </body></html> --test0.xml-- <?xml version="1.0" encoding="utf-8"?> <root> <nolink_logo> </nolink_logo> </root> --test0.xsl-- <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html" encoding="utf-8"/> <xsl:template match="root"> <xsl:apply-templates select="nolink_logo"/> </xsl:template> <xsl:template match="nolink_logo"> <xsl:call-template name="Test" /> </xsl:template> <xsl:template name="Test"> <xsl:variable name="menu" select="document('test1.xml')/root"/> <div>画像を表示 <xsl:for-each select="$menu"> <xsl:element name="a"> <xsl:attribute name="href"> <xsl:value-of select="url[1]"/> </xsl:attribute> <xsl:attribute name="target">_blank</xsl:attribute> <xsl:element name="img"> <xsl:attribute name="src"> <xsl:value-of select="img[1]"/> </xsl:attribute> </xsl:element> </xsl:element> </xsl:for-each> </div> </xsl:template> </xsl:stylesheet> --test1.xml-- <?xml version="1.0" encoding="utf-8"?> <root> <img>http://domain/image2.gif</img> <url>http://domain/test.html</url> </root>

  • xmlから吐き出したhtmlデータのソースインデントがきかない

    xmlとxsltを使って、htmlを吐き出しているのですが、 <xsl:output indent="yes"/> indent="yes"を入れてもindentされません。 xsltは下記になります。 <?xml version="1.0" encoding="shift_jis"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:param name="id" /> <xsl:output method="xml" standalone="yes" encoding="Shift_JIS" omit-xml-declaration="yes" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" indent="yes" /> <xsl:template match="/"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>KDS</title> <meta http-equiv="Content-Type" content="text/html; charset=shift_jis" /> <link rel="stylesheet" href="/css/style.css" type="text/css" /> <meta http-equiv="Content-Script-Type" content="text/javascript" /> <script type="text/javascript" src="/js/snavi_case.js"><xsl:comment>//</xsl:comment></script> </head> <body> <xsl:apply-templates select="info/group/page[@fileId='pteach' and @fileId = $id]" mode="main"/> </body> </html> </xsl:template> <xsl:template match="info/group/page" mode="main"> <xsl:value-of select="title"/> <table width="539" border="1"> <xsl:apply-templates select="teacher[position() mod 3 = 1]"/> </table> </xsl:template> <xsl:template match="teacher"> <tr> <td><xsl:value-of select="name"/>:<xsl:value-of select="subject"/></td> <td><xsl:value-of select="following-sibling::teacher[1]/name"/>:<xsl:value-of select="following-sibling::teacher[1]/subject"/></td> <td><xsl:value-of select="following-sibling::teacher[2]/name"/>:<xsl:value-of select="following-sibling::teacher[2]/subject"/></td> </tr> </xsl:template> </xsl:stylesheet> ただ、<html>~<body>と</body>~</html>はしっかりとソースがインデントされるのですが、<xsl:apply-templates select="info/group/page[@fileId='pteach' and @fileId = $id]" mode="main"/>で読み込んだところ以降のindentが全くきいていないようです。 こんな感じになります。 <html> <title></title> <body>#ここまではindentは正常 <table><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr></table> #indentが効いていない! </body> </html> どなたか同じような状況になられた方、 いらっしゃいませんでしょうか。

    • ベストアンサー
    • XML