title: transforming dates from yyyy-mm-dd to dd/mm/yyyy catering for null or empty dates in xslt
body: <p>I wanted to change the order of dates from yyyy-mm-dd to dd/mm/yyyy but cater for null or empty dates
  I used the code</p>
  
  <pre><code>&lt;!--         Data Submitted --&gt;
  &lt;xsl:template match="data_submitted"&gt;
  &lt;data_submitted&gt;
      &lt;xsl:if test="data_submitted != ''"&gt;
              &lt;xsl:value-of select=
             "concat(substring(.,9), '/',
                    (substring(.,6,2)), '/',
                   substring(.,1,4))"
             /&gt;
      &lt;/xsl:if&gt;
  &lt;/data_submitted&gt;   
  &lt;/xsl:template&gt;
  &lt;!--                                           --&gt;
  </code></pre>
  
  <p>but this omitted dates altogether. Leaving out the  resulted in the null dates appearing as // in my result. I'm sure I have probably got the if in the wrong place or something, but I want a  tag to appear even if it is empty.</p>
  
  <p>Any suggestions? </p>
  
  <h3>Update:</h3>
  
  <p>Apologies everyone, I should have given the initial xml as I was testing for null or empty and there were actually spaces in the element, so my initial translation would have worked if I just put in the number of spaces. The original xml is: <code>data_submitted&gt;        &lt;/data_submitted&gt;</code> with 8 spaces.
  <code>test="data_submitted != '        '"</code>
  is what was required or:
  <code>test=".!= ''"</code>, each with 8 spaces.</p>