You can calculate the rotation values from the XSectionPosition which gives the normalized position over the current section on X Spline (0.0 to 1.0) - a section is a path between two Start, End, Corner, Evenly or Marker segments. Just please note, that you should assign some Segment (it can be even an empty Segment) to the Markers slot to affect the calculation. Once done, the following expression should do the trick:
Please find attached the modified scene (230116_Railing_Gradient_iToo.max).
I hope that helps.