The essential of the X-ray pulsar navigation (XNAV) is the accurate measurement and transfer of time. Pulsars position error is one of the most important factors affecting the precision of time transfer, so it is one of the most important factors which affect the precision of XNAV. By combining pulsars position with spacecraft position and velocity, a new navigation algorithm is proposed. Results show that the effect of the pulsars position error in XNAV is well dealt by this algorithm, so the new algorithm is referable to the application of XNAV.