Exact solution and magnetic properties of an anisotropic spin ladder