XSLT <xsl:attribute> ÔªËØ
¶¨ÒåºÍÓ÷¨
<xsl:attribute> ÔªËØÓÃÓÚÏòÔªËØÌí¼ÓÊôÐÔ¡£
×¢ÊÍ£º<xsl:attribute> ÔªËØ»áÌæ»»Ãû³ÆÏàͬµÄÒÑÓÐÊôÐÔ¡£
Óï·¨
<xsl:attribute name="attributename" namespace="uri"> <!-- Content:template --> </xsl:attribute>
ÊôÐÔ
ÊôÐÔ | Öµ | ÃèÊö |
---|---|---|
name | attributename | ±ØÐè¡£¹æ¶¨ÊôÐÔµÄÃû³Æ¡£ |
namespace | URI | ¿ÉÑ¡¡£ÎªÊôÐÔ¶¨ÒåÃüÃû¿Õ¼äµÄ URI¡£ |
ʵÀý
Àý×Ó 1
Ïò picture ÔªËØÌí¼Ó source ÊôÐÔ£º
<picture>
<xsl:attribute name="source"/>
</picture>
Àý×Ó 2
Ïò picture ÔªËØÌí¼Ó source ÊôÐÔ£¬²¢Ê¹Óà "images/name" ÖеÄֵΪÆä¸³Öµ£º
<picture><xsl:attribute name="source">
<xsl:value-of select="images/name" /></xsl:attribute>
</picture>
Àý×Ó 3
´´½¨Äܹ»Ó¦Óõ½ÈκÎÊä³öÔªËØµÄÊôÐÔ¼¯£º
<xsl:attribute-set name="font"> <xsl:attribute name="fname">Arial</xsl:attribute> <xsl:attribute name="size">14px</xsl:attribute> <xsl:attribute name="color">red</xsl:attribute> </xsl:attribute-set>