XSLT <xsl: attribute>
❮ استكمال مرجع عنصر XSLT
التعريف والاستخدام
يُستخدم عنصر <xsl: attribute> لإضافة سمات إلى العناصر.
ملاحظة: يستبدل العنصر <xsl: attribute> السمات الحالية بأسماء مكافئة.
بناء الجملة
<xsl:attribute name="attributename" namespace="uri">
<!-- Content:template -->
</xsl:attribute>
صفات
Attribute | Value | Description |
---|---|---|
name | attributename | Required. Specifies the name of the attribute |
namespace | URI | Optional. Defines the namespace URI for the attribute |
مثال 1
أضف سمة مصدر إلى عنصر الصورة:
<picture>
<xsl:attribute name="source"/>
</picture>
مثال 2
أضف سمة مصدر إلى عنصر الصورة واملأها بقيم من "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>
❮ استكمال مرجع عنصر XSLT