This will create an uncompressed .tar with the wrong name. You need a z option to specify gzip.
tar -caf foo.tar.xz foo
Will be an xz compressed tarball.