You have to make it from the bottom to the top without touching any checkpoints. That way, you can free the sliding platform, die, and respawn below, in position to collect the trinket.
The most important part is that you must respawn in the same room. Else the platforms will reset and you'll be stuck again.