Crossing heavy-flavour thresholds in fragmentation functions