In legacy Dolfin, you can project u.dx(i) into a suitable function space. If u is a vector, det derivative of the ith component in the jth direction is u[i].dx(j).
If u is in a pth order Lagrange space, the derivative should be in DG p-1.
In DOLFINx, you can interpolate this quantity into a suitable space instead