This is tricky to resolve because there's not a way with a single generator to make some of the horizontal elements flat, while others deform to follow the spline. I've found a workaround by creating two generators, one for the top of the wall and one for the bottom.
In order for the vertical segments to align correctly, both generators must use the same spline and this should be the that defines the roof-line. All the segments for the top of the style have been set to vertical to ensure they follow the curve. The segments for the bottom of the wall have been set to Stepped mode so that they don't follow the spline and moved down to the ground-plane using the Arithmetic expression -XSplineCoords.z
The top and bottom are separated using a clipping spline that cuts the style in two. In the image above it's the white rectangle. For the generator that creates the top of the wall the clipping mode is set to Include
and for the bottom it is set to Exclude
. By doing this the two halves should fit nicely together.
The completed node tree looks like this:
I've attached the file for you to look at. There's also a more complex A2S version included. I hope that helps, please let me know if you need anything further.