Can you swap a transverse engine donor and place it longitudinal to match the race car's original longitudinal orientation?
Yes a K20 or K24 in a miata is XP legal.
E.g. If your XP car is a Fiat X19, you could put a S2000 Engine in it, but it would have to be longitudinally mounted as it was originally in the Fiat.
X1/9 is transverse mounted. So an S2000 engine would have to be transverse mounted in the X1/9.