Answers for "XMLUpdater - Conditional XQuery to keep existing element values if update attributes are empty" https://knowledge.亚搏在线safe.com/questions/67917/xmlupdater-conditional-xquery-to-keep-existing-ele.html The latest answers for the question "XMLUpdater - Conditional XQuery to keep existing element values if update attributes are empty" Answer by takashi https://knowledge.safe.com/answers/67934/view.html

Hi@dms2, a possible way is to extract the original values from the source XML document as feature attributes (e.g._original_minx, _original_maxx etc.), merge them to the Update feature, then use them in the expressions.e.g.

if (fme:get-attribute('_minx') ne '') then fme:get-attribute('_minx') else fme:get-attribute('_original_minx')

Alternatively, the XMLXQueryUpdater can also be used more flexibly, if you merge the new values (_minx, _maxx etc.) to the feature which has the XML document.Assuming that the feature has an attribute called "response" which stores this XML document, the following setting is possible.

       
       
        
         0
        
        
         100
        
       

XQuery Expression:

let $minx := xs:string(fme:get-attribute("_minx")) let $maxx := xs:string(fme:get-attribute("_maxx")) return { if ($minx ne '') then replace value of node /root/minx with $minx else (), if ($maxx ne '') then replace value of node /root/maxx with $maxx else () }

Tue, 10 Apr 2018 23:11:52 GMT takashi