I'm trying to create dynamic XMLs based on data stored in a javascript object. The problem is that the source data for certain attributes may contain null, which will result in Handlebars rendering the attribute with an empty string, while I would like Handlebars to just ignore it, and not render it at all. I suppose I could make a template with a helper like this:
<item {{if id}}id={{id}}{{/if}}></item>
But it just seems like a lot of work, and makes the whole thing unreadable. Is there a nicer way of getting the same results? Or would it perhaps be a better idea to traverse the whole XML after rendering and deleting attributes having empty strings?