I'm working with the XMLTemplater and would like to know if it's possible to conditionally process subtemplates.
ie if attr1 = "a" then {fme:process-template("X")} else {fme:process-template("Y")}
I'm working with the XMLTemplater and would like to know if it's possible to conditionally process subtemplates.
ie if attr1 = "a" then {fme:process-template("X")} else {fme:process-template("Y")}
I think you can use this syntax.
-----
{if(fme:get-attribute("attr1") eq "a") then {fme:process-template("X")} else {fme:process-template("Y")}}
-----
Takashi
---
A common use case is to write out an XML element only if a feature attribute has a value. To do this, an if-then-else statement is used. The following example writes out the displayName element only if the feature contains a display_name attribute, and value of the attribute is not an empty string.
<road>
{ if( fme:has-attribute("display_name") and
not(fme:get-attribute("display_name") eq "") )
then <displayName>{fme:get-attribute("display_name")}</displayName>
else ()
}
</road>