And I would like the "note" to show up in the XML only when there are some values in OpeningTime
I know I should follow if then else logic, but so far I'm only getting XMLTemplater errors.
(FME Desktop 2018)
Thanks,
Linda
Best answer by takashi
Hi @llindish, the syntax error seems to be caused by wrong usage of "fme:has-attribute" and "fme-get-attribute" functions.
If you want to create the "OperatingTime" element only if the "opening_time" attribute exists and the "closing_time" is not empty, this expression could work for you.
<OperatingTimeList>
<OpeningTime>{fme:get-attribute("opening_time")}</OpeningTime>
<ClosingTime>{fme:get-attribute("closing_time")}</ClosingTime>
{
if (fme:has-attribute("opening_time") and not(fme:get-attribute("closing_time") eq ""))
then <OperatingTime dayOfweek="" note="we are open" />
else ()
}
</OperatingTimeList>
Hi @llindish, the syntax error seems to be caused by wrong usage of "fme:has-attribute" and "fme-get-attribute" functions.
If you want to create the "OperatingTime" element only if the "opening_time" attribute exists and the "closing_time" is not empty, this expression could work for you.
<OperatingTimeList>
<OpeningTime>{fme:get-attribute("opening_time")}</OpeningTime>
<ClosingTime>{fme:get-attribute("closing_time")}</ClosingTime>
{
if (fme:has-attribute("opening_time") and not(fme:get-attribute("closing_time") eq ""))
then <OperatingTime dayOfweek="" note="we are open" />
else ()
}
</OperatingTimeList>
Hi @llindish, the syntax error seems to be caused by wrong usage of "fme:has-attribute" and "fme-get-attribute" functions.
If you want to create the "OperatingTime" element only if the "opening_time" attribute exists and the "closing_time" is not empty, this expression could work for you.
<OperatingTimeList>
<OpeningTime>{fme:get-attribute("opening_time")}</OpeningTime>
<ClosingTime>{fme:get-attribute("closing_time")}</ClosingTime>
{
if (fme:has-attribute("opening_time") and not(fme:get-attribute("closing_time") eq ""))
then <OperatingTime dayOfweek="" note="we are open" />
else ()
}
</OperatingTimeList>
We use 3 different kinds of cookies. You can choose which cookies you want to accept. We need basic cookies to make this site work, therefore these are the minimum you can select. Learn more about our cookies.