title: How to use Groovy XML MarkupBuilder to create valid HTML script tags?
body: <p>I am using Groovy 1.8 XML MarkupBuilder to build an HTML page which includes a <code>&lt;script&gt;</code> tag.</p>
  
  <p>When I load the page in Firefox 18 I see a blank page instead of the expected results.</p>
  
  <p>This seems to be due to the generated <code>&lt;script&gt;</code> tag not having a complementary <code>&lt;/script&gt;</code> tag,
  even though there is no content to warrant the <code>&lt;/script&gt;</code> tag.
  (See: <a href="https://stackoverflow.com/questions/69913/why-dont-self-closing-script-tags-work" title="Why Don&#39;t Self Closing Script Tags Work?">https://stackoverflow.com/questions/69913/why-dont-self-closing-script-tags-work</a> )</p>
  
  <p>Sample Groovy code:</p>
  
  <pre><code>def builder = new groovy.xml.MarkupBuilder( out )
  
  builder.html {
    head {
      script( type:'text/javascript', src:'//example.com/example.js' )
    }
  
    body {
      p("Hello...Newman.")
    }
  }
  </code></pre>
  
  <p>If I examine the (blank) rendered page's HTML using Firefox's "View Page Source" (Ctrl-U), I see:</p>
  
  <pre><code>&lt;html&gt;
    &lt;head&gt;
      &lt;script type='text/javascript' src='//example.com/example.js /&gt;
    &lt;/head&gt;
    &lt;body&gt;
      &lt;p&gt;Hello...Newman.&lt;/p&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Looking closely, I see the '/' on the <code>&lt;script ... /&gt;</code> tag is rendered in red,
  and the hover-over text on the '/' says "Self-closing syntax ("/>") used on a non-void HTML element. Ignoring the slash and treating as a start tag."</p>
  
  <p>So, how do I generate valid HTML <code>&lt;script&gt;</code> tags using Groovy XML MarkupBuilder ?</p>