ປະກອບ <xsl:attribute> XSLT
ການກໍານົດ ແລະ ການນໍາໃຊ້
ປະກອບ <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>