A man has been charged with attempted murder after allegedly stabbing a police officer with a sword in Sydney's southwest. Police say some of his colleagues gave critical first aid while others restrained the man.