Transform XML to add 'nil' attributes to empty elements
<p>An existing XML feed we consume has a lot of properties whose values can be missing, and we want to treat these as NULL not optional or empty values because it makes enforcing strict typing harder and messes up our auto code generation and so on.</p>

<p>For instance we might receive:
<code>&lt;LASTUPDATED/&gt;</code></p>

<p>We have no formal XSD but are creating one ourselves... it might currently look like: <code>&lt;xs:element type="xs:dateTime" name="LASTUPDATED"/&gt;</code></p>

<p>This doesn't validate against the XML shown (<code>""</code> is not a valid <code>dateTime</code>). Ideally it would instead have <code>xsi:nil=true</code> in the XML (<a href="https://stackoverflow.com/questions/1903062/nillable-and-minoccurs-xsd-element-attributes">nillable and minOccurs XSD element attributes</a>)</p>

<p>Since we don't control the feed, can I create a transform that will replace any <code>&lt;xxx/&gt;</code> element with <code>&lt;myElement xsi:nil='true'/&gt;</code>? Instead changing our XSD to use <code>minOccurs</code> is not great because then we have to check if each element exists or not rather than just supporting NULL values.</p>