・xml内で画像ファイルやwidth属性、height属性、alt属性を指定する方法
・xslで<xsl:attribute>を使い、xml内の画像ファイル名や、各属性値を取り出す。
[サンプルXML文書を表示](下のフレームに)
XMLソース
<?xml version="1.0" encoding="Shift_JIS" ?>
<?xml-stylesheet type="text/xsl" href="img02.xsl"?>
<start>
<top>画像の表示
<sub>(xml内で画像ファイルを指定する方法)</sub>
</top>
<画像>
<imgfile width="103" height="116">../../images/cut/025.gif</imgfile>
<alt>xml内で画像ファイルを指定する方法</alt>
</画像>
<end>以上です(00/11/2)</end>
</start>
XSLソース
<?xml version="1.0" encoding="Shift_Jis"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">
<H3><xsl:value-of select="start/top"/></H3>
<xsl:apply-templates select="start/画像"/>
</xsl:template>
<xsl:template match="start/画像">
<img>
<xsl:attribute name="src">
<xsl:value-of select="imgfile"/>
</xsl:attribute>
<xsl:attribute name="width">
<xsl:value-of select="imgfile/@width"/>
</xsl:attribute>
<xsl:attribute name="height">
<xsl:value-of select="imgfile/@height"/>
</xsl:attribute>
<xsl:attribute name="alt">
<xsl:value-of select="alt"/>
</xsl:attribute>
</img>
</xsl:template>
</xsl:stylesheet>
end(00/11/2)