The answer is no, you cannot.
You cannot directly use XML value() in FOREIGN KEY . For fun, I tried to create a computed column that has the result of calling .value('<some xpath>', 'int') wrapped in a user-defined function. The problem is that you also cannot use the computed column in relation to the FOREIGN KEY .
Outside of the actual limit, you can try to test incoming INSERT and UPDATE in a trigger ... but this is already becoming a solution problem. As Damien says, this doesn’t really apply to an XML document if you want to apply a foreign key constraint.
source share