Hello,
I think your XPath is might be wrong. Your XPath should be start with root node. Can you give the schema structure of "bakery-mstr" secondary dom to give correct XPath of the field. Check once your filter condition also.
XPath should change like this,
("/d:bakery-mstr[@bk-contact='" and strcontactId != "']")
@bk-contact='" > this field equal to blank
strcontactId != "' -> this field value is not blank