The workers, who operate the Roslagsbanan line north of the Swedish capital Stockholm, have been wearing skirts to work for the past two weeks to keep cool in the hot weather.
Employer Arriva banned the drivers from wearing shorts after taking over the running of the line in January, BBC News reported.
While the company has an objection to male employees wearing shorts, it has no problem with them coming to work in skirts.
"Our thinking is that one should look decent and proper when representing Arriva and the present uniforms do that. If the man only wants [to wear] a skirt then that is OK," Arriva communications manager Tomas Hedenius told the Swedish newspaper Mitti.
"To tell them to do something else would be discrimination," he said.
Driver Martin Akersten told the BBC that he and his colleagues came up with the idea to wear skirts after they were informed of the new company dress code in the winter.
"We have always said that when summer comes, we will get some skirts and wear them. It's very warm weather here so we would like to wear shorts but if we can't then we have skirts for comfort," Akersten said.
The male drivers have chosen to wear skirts only on hot days, opting for trousers in cooler conditions.
Five dead in shooting in Southern California college
UK's Prince Philip recovering after surgery
Despite racism, UK Sikhs proud to be British: Survey
IMAGES: Worst flood in 70 years inundates central Europe
Angelina Jolie makes first appearance post mastectomy