Naming convention for contextual alternates within a styleset

My question relates to the order of the suffixes.
For example, I have the glyphs f, f.ss01 and f.ss01.alt.
Should the last be named f.ss01.alt or f.alt.ss01?
I’m trying to activate the calt f.ss01 when it precedes a d.ss01

> sub f.ss01' d by f.ss01.alt;

I’ve tried both variations with no success. Is the naming order the source of the problem, or am I missing something?
Thanks in advance.

What constitutes success? You cannot automate calt. So all you have to make sure is copy the correct glyph name into your feature code and make sure the features are in the right order.

I’m not trying to automate, I’ve written the code as shown above, but in either case, whether I try f.alt.ss01 as a glyph name with corresponding calt feature code, or f.ss01.alt with it’s corresponding feature code, neither works.
In testing (InDesign, Illustrator) f.ss01.alt character doesn’t appear as an option, (but f.alt does for the regular f).
At the moment calt is the last feature in the feature list (preceded by liga, sso2, ss01, salt etc). Is the feature order what I need to change?

The naming only matters when you like to use automatic feature code.

Your problem is most likely that the feature order is wrong. Or that there are different Glyphs in the string by the time your feature is executed.

Thanks Georg. I’ll have a go at sorting through the logic of the feature order.

After feature order, make sure you update your aalt.