Example 1, check if the number is empty (the document is new) and if the Priority is set, then set the value to Current Date + Years [certain number based on priority]. If the date field is not empty then set the value to the existing value

if(//SYS_BUSINESS_NUMBER = "") then ( 

if(//DOCCON_DOC_PRIORITY = "1") then (current-date() + xs:yearMonthDuration('P1Y')) else (if (//DOCCON_DOC_PRIORITY = "2") then (current-date() + xs:yearMonthDuration('P2Y') ) else (if (//DOCCON_DOC_PRIORITY = "3") then (current-date() + xs:yearMonthDuration('P3Y') ) else ( if (//DOCCON_DOC_PRIORITY = "4") then (current-date() + xs:yearMonthDuration('P5Y') ) else current-date()))  )) else //DOCCON_MAIN_DOC_ID_REVIEW_DATE

 



Example 2, 


if (//DEVIATION_SUPPLIER_DUE_DATE/text() != '') then //DEVIATION_SUPPLIER_DUE_DATE else current-date() + xs:dayTimeDuration('P90D')