Skip to main content

Hi list.

I'm currently trying to generate a composite XML using XmlTemplater.

One of the details is that tags without text value must not be output at all.

I tried to utilize the following expression (from the help page):

{ if( {fme:has-attribute("mailadresse")} )
then <ler:mailadresse>{fme:get-attribute("mailadresse")}</ler:mailadresse>
else ()}

My expectation (for "else") is that output is only generated if an attribute value is present.

Much to my surprise, "<ler:mailadresse/>" is output instead, even though the attribute value in question is <null>.

Can anyone share how to tweak the expression, so "else" produces absolutely no output ?

And yes, the presence of the "else" part seems to be mandatory.

Using 2020.0

Hmm. It seems I needed to add the >> not(fme:get-attribute() eq "") << part as well, to have the <null> values fails the condition.

Seems a little quirky to me.


I think has attribute tests for if the attribute exists, i.e. not missing. If if is null or empty the attribute still exists and you have to include the test for a value. You could use a nullattributemapper beforehand instead to map empties and nulls to missing


I think has attribute tests for if the attribute exists, i.e. not missing. If if is null or empty the attribute still exists and you have to include the test for a value. You could use a nullattributemapper beforehand instead to map empties and nulls to missing

Yeah, came to the same conclusion when I tested some more. Thanks for answering anyway.


Reply