XSLT <xsl:attribute> एलीमेंट

विनिर्धारण और उपयोग

<xsl:attribute> एलीमेंट एलीमेंट को एट्रिब्यूट जोड़ने के लिए उपयोग किया जाता है。

टिप्पणी:<xsl:attribute> एलीमेंट नाम समान पहले एट्रिब्यूट को प्रतिस्थापित करेगा。

व्याकरण

<xsl:attribute name="attributename" namespace="uri">
  <!-- सामग्री:टेम्पलेट -->

एट्रिब्यूट

एट्रिब्यूट मूल्य वर्णन
नाम एट्रिब्यूटनाम आवश्यक। एट्रिब्यूट के नाम को निर्धारित करें。
नामस्पाद्य यूरी वैकल्पिक। एट्रिब्यूट के लिए नामस्पाद्य यूरी निर्धारित करें。

इन्स्टांस

उदाहरण 1

पिक्चर एलीमेंट में सोर्स एट्रिब्यूट जोड़ें:


  <xsl:attribute name="source"/>

例子 2

向 picture 元素添加 source 属性,并使用 "images/name" 中的值为其赋值:


  
    
  

例子 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>