リンクの設定と同じように、<a href="mailto:メールアドレス">形式の属性を創出すればよい。
[サンプルXML文書を表示](下のフレームに)
サンプルの名前をクリックすると「メッセージの作成」ボックスが開く(OutlookExpressの場合)。サンプルのメールアドレスは架空です。
XMLソース
<?xml version="1.0" encoding="Shift_JIS" ?>
<?xml-stylesheet type="text/xsl" href="link03.xsl"?>
<root>
<title>メールにリンクを設定</title>
<data>
<mail1><name>閻魔大王</name><ado>ennma@daio.jp</ado></mail1>
<mail2><name>孫悟空</name><ado>goku@son.jp</ado></mail2>
<mail3><name>虎様</name><ado>tigers@hansin.jp</ado></mail3>
</data>
<end>以上です(2005/4/16)</end>
</root>
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="html" encoding="Shift_JIS"/>
<xsl:template match="/">
<center><H3><xsl:value-of select="root/title"/></H3></center>
<xsl:apply-templates select="root/data"/>
</xsl:template>
<xsl:template match="data">
<a>
<xsl:attribute name="href">
mailto:<xsl:value-of select="mail1/ado"/>
</xsl:attribute>
<xsl:value-of select="mail1/name" />
</a>
<hr/>
<a>
<xsl:attribute name="href">
<xsl:value-of select="concat('mailto:', mail2/ado)"/>
</xsl:attribute>
<xsl:value-of select="mail2/name" />
</a>
<hr/>
<a href="mailto:{mail3/ado}">
<xsl:value-of select="mail3/name" />
</a>
</xsl:template>
</xsl:stylesheet>
end(05/4/16)