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

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

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

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

व्याकरण

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

अट्रिब्यूट

अट्रिब्यूट मान वर्णन
name attributename आवश्यक।अट्रिब्यूट का नाम निर्धारित करें。
नामस्पेस 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>