・XSLで属性を生成し、HTMLタグに追加できる。
★書式★
<xsl:attribute name="属性名"
namespace="関連url">
属性の値を指定
</xsl:attribute>
[サンプルXML文書を表示](下のフレームに)
XMLソース
<?xml version="1.0" encoding="Shift_JIS" ?> <?xml-stylesheet type="text/xsl" href="attribute01.xsl"?> <start> <top>属性の生成</top> <contents> <sample>サンプル(style属性を設定)</sample> <sample2>サンプル2(style属性とalign属性を設定)</sample2> </contents> <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="/"> <H4><xsl:value-of select="start/top"/></H4> <xsl:apply-templates select="start/contents"/> </xsl:template> <xsl:template match="contents"> <DIV> <xsl:attribute name="style">margin-left:3cm;color:green</xsl:attribute> <xsl:value-of select="sample"/> </DIV> <DIV> <xsl:attribute name="style">color:magenta;font:16pt bold</xsl:attribute> <xsl:attribute name="align">center</xsl:attribute> <xsl:value-of select="sample2"/> </DIV> </xsl:template> </xsl:stylesheet>
end(00/11/2)