yes pretty much what solopy567 said. Illya, being that she is a decendant of the actual women who was there with Zeltretch, used her magic to let shirou look into the past so that he could experience himself being there. Reason for this is because he can only copy the ACTUAL version of the sword so he needed to see the real thing before he could make it. By him seeing what the ancestor of Illya saw, this was accomplished. Then it was just a matter of him recreating it for Rin and voila, we have a sword.