EDX data provides surface analysis precisely only if proper mapping is performed. Otherwise, the surface scanning using EDX is not very precise. On the other hand, XPS scanning is much more precise. Also, XPS scanning can penetrate certain nanometers (probably 5-10 nm) depth from the surface. Thus, it may occur that, the density of N is lesser on the surface.