title: XSLT: If tag exists, apply template; if not, choose static value
body: <p>I am new to XSLT in general so please bear with me...</p>
  
  <p>With that in mind, what I am trying to do is check for a certain tag in the XML.  If it is there I want to apply a template.  If not, I want to add it (as a blank value).  Basically always forcing it to be in the final output.  How would I do this? </p>
  
  <p>I had something like this...</p>
  
  <pre><code>&lt;xsl:choose&gt;
      &lt;xsl:when test="@href"&gt;
          &lt;xsl:apply-templates select="country" /&gt;
      &lt;/xsl:when&gt;
      &lt;xsl:otherwise&gt;
      &lt;/xsl:otherwise&gt;
  &lt;/xsl:choose&gt;
  </code></pre>
  
  <p>The top poriton of the code is what I think I have wrong. Need something in the <code>otherwise</code> tag and my <code>when</code> part is wrong i think.</p>
  
  <pre><code>&lt;xsl:template match="country"&gt;
      &lt;xsl:if test=". != '' or count(./@*) != 0"&gt;
          &lt;xsl:copy-of select="."/&gt;
      &lt;/xsl:if&gt;
  &lt;/xsl:template&gt;
  </code></pre>
  
  <p>Can anyone help? Thank you in advance.</p>
  
  <p>EDIT:</p>
  
  <p>Yes in the end i need at the very least a <code>&lt;country /&gt;</code> tag to be in the XML.  But it is possible that it does not exist <strong>at all</strong>.  If it doesn't exist, I have to put it in.  An example good input would be <code>&lt;country&gt;US&lt;/country&gt;</code></p>