XSLT <xsl:attribute> ਅਣਪੂਰਣ

ਪਰਿਭਾਸ਼ਾ ਅਤੇ ਵਰਤੋਂ

<xsl:attribute> ਅਣਪੂਰਣ ਅਣਪੂਰਣ ਵਿੱਚ ਅਣਪੂਰਣ ਜੋੜਨ ਲਈ ਵਰਤਿਆ ਜਾਂਦਾ ਹੈ。

ਟਿੱਪਣੀ:<xsl:attribute> ਅਣਪੂਰਣ ਨਾਮ ਵਾਲੇ ਮੌਜੂਦਾ ਅਣਪੂਰਣ ਨੂੰ ਬਦਲ ਦੇਵੇਗਾ。

ਗਰੰਥ

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

ਅਣਪੂਰਣ

ਅਣਪੂਰਣ ਮੁੱਲ ਵਰਣਨ
name attributename ਲਾਜ਼ਮੀ। ਅਣਪੂਰਣ ਨਾਮ ਨਿਰਧਾਰਿਤ ਕਰੋ。
namespace 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>