Hello there,
I tried to comment on content of post https://knowledge.safe.com/questions/52852/seperate-a-single-field-values-into-two-xml-elemen.html# but for some obscure reason wasn't able to do so.
My question is a follow-up to the remark of @takashi in the other post concerning the tokenizer function:
Note: <bnr:foreignKey> elements would not be created if fme:get-attribute($fkey) was empty.I ran into exactly that kind of situation. What would I do to avoid this?
I'm thinking about an if then else conditional statement but fear I am not capable of doing that. Assuming that $anykey is empty - would such a construct work?
{
if ( fme:get-attribute($anykey) ne "" ) then
{
for $k in fn:tokenize(fme:get-attribute($anykey), '#')
return
<mri:keyword>
<gco:CharacterString>{$k}</gco:CharacterString>
</mri:keyword>
}
else
{
return
<mri:keyword>
<gco:CharacterString/>
</mri:keyword>
}
}
Unfortunately, this results in
(XMLTemplaterFactory): invalid expression: syntax error, unexpected ExprSingle (missing comma "," between expressions?)"kind of errors, now matter how much I shuffle with both sorts of brackets.
Sorry, but I am totally new to this kind of syntax. Btw., is this some sort of XQuery language or a FME transformer specific adaptation?
Thanks for the help. It's much appreciated!