title: How to render a self closing HTML tag with attributes in XSLT?
body: <p>Well I want to render a self closing tag say <code>&lt;img&gt;</code> tag like this <code>&lt;img src="xyz.jpg" /&gt;</code></p>
  
  <p>But I don't know how to do that...I mean how to render a self closing tag.
  What I'm having so far is below:-</p>
  
  <p>Here is the XML: </p>
  
  <pre><code>&lt;c:Image src="xyz.jpg"&gt;&lt;/c:Image&gt;
  </code></pre>
  
  <p>And here is the XSLT: </p>
  
  <pre><code>&lt;xsl:output indent="yes" omit-xml-declaration="yes" method="html"  /&gt;
  .
  .
  .
      &lt;xsl:for-each select="c:Image"&gt;
       &lt;img&gt;
        &lt;xsl:attribute name="src"&gt;
          &lt;xsl:if test="string-length(@src)&gt;0"&gt;
            &lt;xsl:text&gt;&lt;/xsl:text&gt;
            &lt;xsl:value-of select="@src"/&gt;
          &lt;/xsl:if&gt;
          &lt;/xsl:attribute&gt;
       &lt;/img&gt;
      &lt;/xsl:for-each&gt;
  .
  .
  .
  </code></pre>
  
  <p>Any help appreciated.</p>