XSLT <xsl:attribute> ປະກອບ

ການອະທິບາຍ ແລະ ການນຳໃຊ້

ປະກອບ <xsl:attribute> ຕັ້ງໃຈສະເໜີສັນຍາຕໍ່ປະກອບ.

ບັນທຶກ:ປະກອບ <xsl:attribute> ຈະປ່ຽນທີ່ມີຊື່ຮູບຮ່າງດຽວ.

ສັນຍາວິດີຈະນາ

<xsl:attribute name="attributename" namespace="uri">
  <!-- Content:template -->
</xsl:attribute>

ສັນຍາ

ສັນຍາ ຄູ່ມູນ ການອະທິບາຍ
name attributename ສຳຄັນ. ກຳນົດຊື່ຂອງສັນຍາ.
namespace URI ທາງເລືອກກຳນົດ URI ສັນຊັດສັນຍາ.

ຕົວຢ່າງ

ຕົວຢ່າງ 1

ສະເໜີປະສົມການ source ຕໍ່ປະກອບສັນຍາ picture:

<picture>
  <xsl:attribute name="source"/>
</picture>

ຕົວຢ່າງ 2

ສະເໜີປະສົມການ source ຕໍ່ປະກອບສັນຍາ picture ແລະໃຊ້ຄູ່ມູນຈາກ "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>