title: XSL Replacing an empty node with data
body: <p>This should be simple, but I am unable to figure this one out. I have XML files that contain some empty nodes that I want to replace with a fixed string via XSL. If the node contains data it is fine, but if it is empty I want to replace it with a string "18010101"</p>
  
  <p>For Example:</p>
  
  <p>Before:</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;TopNode&gt;
    &lt;SubNode1&gt;
      &lt;SubNode2&gt;
        &lt;SubNode3&gt;
          &lt;SubNode4&gt;
            &lt;date_of_birth&gt;&lt;/date_of_birth&gt;
          &lt;/SubNode4&gt;
        &lt;/SubNode3&gt;
      &lt;/SubNode2&gt;
    &lt;/SubNode1&gt;
  &lt;/TopNode&gt;
  </code></pre>
  
  <p>After:</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;TopNode&gt;
    &lt;SubNode1&gt;
      &lt;SubNode2&gt;
        &lt;SubNode3&gt;
          &lt;SubNode4&gt;
            &lt;date_of_birth&gt;18010101&lt;/date_of_birth&gt;
          &lt;/SubNode4&gt;
        &lt;/SubNode3&gt;
      &lt;/SubNode2&gt;
    &lt;/SubNode1&gt;
  &lt;/TopNode&gt;
  </code></pre>
  
  <p>I have a similar issue where I replace a fixed value with another fixed value with xsl.</p>
  
  <pre><code>  &lt;xsl:template match="transaction_type[text()='15']"&gt;
      &lt;xsl:text&gt;5&lt;/xsl:text&gt;
    &lt;/xsl:template&gt;
  </code></pre>
  
  <p>It works fine, but when I try to do a similar fix for the date issue it doesn't seem to work.</p>
  
  <pre><code>  &lt;xsl:template match="date_of_birth"&gt;
      &lt;xsl:if test="date_of_birth = ''"&gt;
        &lt;xsl:text&gt;18010101&lt;/xsl:text&gt;
      &lt;/xsl:if&gt;
    &lt;/xsl:template&gt;
  </code></pre>
  
  <p>Thanks</p>