%- if value.class==HQMF::Range -%>
<<%= name %> <%= "xsi:type=\"#{value.type}\"" if include_type %> <%= "highClosed=\"true\"" if value.high && value.high.inclusive? && name != 'pauseQuantity' %> <%= "lowClosed=\"true\"" if value.low && value.low.inclusive? && name != 'pauseQuantity' %>>
<%- # WARNING: Hacky Fixes Above And Below That Must Be Looked At Again! -%>
<%- if name == 'pauseQuantity' -%>
<%= "highClosed=\"true\"" if value.high && value.high.inclusive? %>>
<%= xml_for_value(value.low, 'low') if value.low -%>
<%= xml_for_value(value.high, 'high') if value.high -%>
<%- else -%>
<%= xml_for_value(value.low, 'low', false) if value.low -%>
<%= xml_for_value(value.high, 'high', false) if value.high -%>
<%- end -%>
<%= name %>>
<%- elsif value.class==HQMF::Coded -%>
<%- if value.null_flavor -%>
<<%= name %> nullFlavor="<%= value.null_flavor %>">
<%- if value.original_text -%>
<%- end -%>
<%- else -%>
<%- if value.code_list_id -%>
<<%= name %> <%= "xsi:type=\"#{value.type}\"" if include_type %> valueSet="<%= value.code_list_id %>">
<%- else -%>
<<%= name %> <%= "xsi:type=\"#{value.type}\"" if include_type %> codeSystem="<%= value.system %>" code="<%= value.code %>">
<%- end -%>
<%- if value.title -%>
<%- end -%>
<%- if value.original_text -%>
<%- end -%>
<%- end -%>
<%= name %>>
<%- elsif value.class==HQMF::Value -%>
<%- if value.derived? -%>
<<%= name %> nullFlavor="DER">
<%= name %>>
<%- else -%>
<<%= name %> <%= "xsi:type=\"#{value.type}\"" if include_type %> value="<%= value.value %>"<%= " unit=\"#{value.unit}\"" if value.unit %>/>
<%- end -%>
<%- elsif value.class==HQMF::Identifier -%>
<<%= name %> xsi:type="II" root="<%= value.root %>"<%= " extension=\"#{value.extension}\"" if value.extension %>/>
<%- elsif value.class==HQMF::ED -%>
<<%= name %> xsi:type="ED" mediaType="<%= value.media_type || 'text/plain' %>"<%= " value=\"#{ERB::Util::h value.value}\"" if value.value %>/>
<%- elsif value.class==HQMF::GenericValueContainer -%>
<<%= name %> <%="xsi:type=\"#{value.type}\"" if value.type %> value="<%=ERB::Util::h value.value %>"/>
<%- elsif value.class==HQMF::AnyValue -%>
<<%= name %> xsi:type="ANY" flavorId="ANY.NONNULL"/>
<%- end -%>