I will soon take the sleeper train from Zurich to Ljubljana.
The train route covers Switzerland-Austria-Slovenia. I will not be getting off until my final destination. As of today (May 2022), Slovenia lifted the requirement to show proof of test, recovery or vaccination. Austria still has it AFAIK. Information regarding transiting passengers in such situation is difficult to find.
Do I need to abide by the Austrian rules even if I remain on board the train for the whole crossing of the country?