# Define tensor as a derivative

I have the tensor which is expressed in terms of coordinate vector. I want to define tensor which is the derivative of the former tensor with respect to the coordinate axis: $$X = (x_1, x_2, x_3) \\ TD_{\alpha \beta \gamma} = \frac{\partial T_{\alpha \beta}}{\partial x_\gamma}$$ However, I want to get the result in terms of general expressions of tensors, for example: $$T_{\alpha \beta} = x_\alpha x_\beta \\ TD_{\alpha \beta \gamma} = \delta_{\alpha \gamma} x_\beta + x_\alpha \delta_{\beta \gamma}$$ And also I want if that's possible to evaluate certain components of the tensor at given $$x_\alpha$$ in code.

What I have now in Wolfram Mathematica is the following:

X = {Subscript[x, 1], Subscript[x, 2], Subscript[x, 3]};
r := Sqrt[Sum[(X[[i]]^2, {i, 3}]];
T[i_, j_] :=KroneckerDelta[i, j]/r + X[[i]] X[[j]] / r^3
TD[i_, j_, k_] := D[T[i, j], X[[k]]];

However, that does not allow me to see the whole tensor TD. The program evaluates it as zero:

TD[i, j, k]
0