Yeah, been there... XplinePosition is not working as we expecting and expression like:
return
if(XSplinePosition==0,1,
if(XSplinePosition>0.98,3,2));
will work. But this is not a solution when you have values close to the value of 1.
So, workaround will be nested L1S Generator. With nested generator you'll get more control.