The best advice I would give to writing solos is that if you want to actually write one, just break it down into sections based on the rhythm underneath and just putting melodic parts and keeping notes to the 3rds 4ths 5ths or 8ths to the notes underneath when you bend or hold a note and then shred the scale, any version of key(natural, harmonic or any other), or make a Slayer style solo that is really chromatic to get to the slower parts, or sweep. Just remember that even while shredding, it helps to put rhythm into that. Most of the time, Alexi just does scales in an interesting way by modifiying a pattern in the scale to accomplish the sound that he wants.
I would say that you should listen and play over top of the Rhythm repeatedly and slowly work out the key notes and sounds and then start adding the fast parts inbetween those.
A good example of an almost formulaic way of writing solos is any of Chuck's solos from Death, there is a slow part then shreding then slow then shread.
Bottom line is that Solos are just a bunch of licks put together, played slow or fast.