The sentence is grammatically correct.
However, using 'stopping' implies that the train is in the process of stopping rather than actually not moving at all. So your sentence states that it is ok to use the axe if the train is slowing down but still moving.
If you mean to say that the train must not be in motion at all, you need to say,
When the train has stopped, you can use the axe ....
When the train is stationary, you can use the axe ...