次のような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の内容を表示できない
No.1ベストアンサー
- 回答日時:
いくつか考えられますが、
まずbase.xmlのxml構造としてルート(base)しかないのが気になります。それと
<xsl:template match="base">
base:<xsl:value-of select="base" />
</xsl:template>
ではなく、
<xsl:template match="base">
base:<xsl:value-of select="." />
</xsl:template>
です。
自分のノードにいる場合、
自分を表示するには、「.」を使用します。
お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!
関連するカテゴリからQ&Aを探す
おすすめ情報
- ・漫画をレンタルでお得に読める!
- ・街中で見かけて「グッときた人」の思い出
- ・「一気に最後まで読んだ」本、教えて下さい!
- ・幼稚園時代「何組」でしたか?
- ・激凹みから立ち直る方法
- ・1つだけ過去を変えられるとしたら?
- ・【あるあるbot連動企画】あるあるbotに投稿したけど採用されなかったあるある募集
- ・【あるあるbot連動企画】フォロワー20万人のアカウントであなたのあるあるを披露してみませんか?
- ・映画のエンドロール観る派?観ない派?
- ・海外旅行から帰ってきたら、まず何を食べる?
- ・誕生日にもらった意外なもの
- ・天使と悪魔選手権
- ・ちょっと先の未来クイズ第2問
- ・【大喜利】【投稿~9/7】 ロボットの住む世界で流行ってる罰ゲームとは?
- ・推しミネラルウォーターはありますか?
- ・都道府県穴埋めゲーム
- ・この人頭いいなと思ったエピソード
- ・準・究極の選択
- ・ゆるやかでぃべーと タイムマシンを破壊すべきか。
- ・歩いた自慢大会
- ・許せない心理テスト
- ・字面がカッコいい英単語
- ・これ何て呼びますか Part2
- ・人生で一番思い出に残ってる靴
- ・ゆるやかでぃべーと すべての高校生はアルバイトをするべきだ。
- ・初めて自分の家と他人の家が違う、と意識した時
- ・単二電池
- ・チョコミントアイス
デイリーランキングこのカテゴリの人気デイリーQ&Aランキング
-
XSLTで直下のテキストのみ取得...
-
XSL中の改行、タブを無効にした...
-
CPUの考え方を教えてください ...
-
XMLで要素が記述された順番に意...
-
ルート要素ノードが2個ある場合?
-
東芝のDynabookなのですがアン...
-
MagpieRSSを使用して自分のHPに...
-
特殊記号が勝手にエスケープさ...
-
使用できる文字の規約
-
JavaプログラマとしてのXML
-
このエラー、何とかなりません...
-
XMLファイルの作り方がわかりま...
-
VB6.0でDOMを使用して...
-
4バイトを10進数に変換する方法
-
ToolStripMenuItemの選択(VB)
-
eclipseへのxmlファイル追加
-
VBSでxmlの値を書き換えたい
-
ScalaでXMLファイルからノード...
-
VBでXMLファイルを作ると xmlns...
-
SNMP リンクダウンとノードダ...
マンスリーランキングこのカテゴリの人気マンスリーQ&Aランキング
-
xmlのテキストにリンクを張りた...
-
XSLTで固定長データファイルを...
-
タグの有無の判定
-
XSLで、XMLの空タグを制御したい。
-
XMLのHTMLへの変換 (初心者)
-
xmlの複数条件で検索
-
XSLでXMLデータをタブ区切りデ...
-
スタイルシートを使用したXM...
-
XSL内でJavaScriptを記述し、Ja...
-
XSL中の改行、タブを無効にした...
-
XSLTにてタグ名を取得する方法
-
XML/XSLについて質問です
-
重複するものを消したい
-
xmlの属性が重複しているのをx...
-
XMLの名前空間をXSLから指定す...
-
XSLで特定のタグだけを出力する...
-
XSLTを使用したXML->XML変換で...
-
うまく表示されない
-
XMLから指定テキストのみを抜き...
-
XMLをXSLTやCSSに変換してHTML...
おすすめ情報