XSLT - 外部ファイルの取り込み (xsl:include)Advertisement書式<xsl:include href="インクルードするファイル"/> 例<xsl:include href="include.xsl"/>include.xsl の内容を上記コード位置に記述した場合と同じ動作を行う。 サンプルコード
sample.xml
<?xml version="1.0" encoding="Shift_JIS"?>
<?xml-stylesheet type="text/xsl" href="./style.xsl"?>
<book>
<title>XML</title>
<price>1000</price>
</book>
style.xsl
<?xml version="1.0" encoding="Shift_JIS"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:include href="include.xsl"/> </xsl:stylesheet>include.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>XSLT</title>
</head>
<body>
<xsl:apply-templates select="book"/>
</body>
</html>
</xsl:template>
<xsl:template match="book">
<xsl:value-of select="title"/><br/>
<xsl:value-of select="price"/>
</xsl:template>
</xsl:stylesheet>
生成されるコード
<html> <head> <title>XSLT</title> </head> <body> XML<br /> 1000 </body> </html> Advertisement |
ショートカット・634・634ブログ ・このカテゴリのトップページに戻る ・Incubator(Pukiwiki) ・634ラボ UIコレクションギャラリー ZO-3ジェネレーター サイト検索Y!ログール |