If you haven't found it yet, there is a Manual with about 5 bikes in it. I was able to find a wire diagram on page 232. Seem to have all the answers.
The Headlight 3 wires are just going to handle bar switch, or ground.
The Switch is receiving power from a relay via wire color marked (L/B) L=Blue, B=Black That page didn't list that color pair,
The relay is getting power from the stator, from the Y Wire, (Yellow)
The wire from the Fuse, is R/Y Red/Yellow.
When you look at that diagram, the relay has a squiggly line, over the SPST switch. What that basically means, is, the Headlight is not going to turn on, unless the Stator has generated some electricity.
this was based on the XS400F only
Of coarse I was looking at the XS400F only wire diagram. I couldn't tell from your description which one you have.
I say it like that because the stator can spin, enough and fake out the relay into lighting up the Headlights. It was designed that way so that the electrical draw, will not kill the bike, before its started.
Sometime one of us had open up that relay, and looked at it. It was very interesting what he found. (I dont recommend doing that, I seem to believe that most of these old relays are fine, created to last.) If your head light isn't working, don't get worked up over that until the bike is running, then get some hard stats from your stator. So your Y (Yellow) wire, how much volts/amps are being sent down that line? One other note, there is a diode, that may have been abused, and is broken.
As long as I am here, The Yellow line is A/C (Alternating Current) from the Stator. Diodes protect the rest of the electrical systems including the battery from A/C power. Somethings may not care if power is AC or DC, but somethings will not handle the other well. (note there is one regular poster whom had his wife on fire bottle standby, when he first started his bike.) Great story!
http://www.xs400.com/forum/showthread.php?t=14495 (Re-Run) Free-Full Yamaha Manuals download 45 megs
This was based on the XS400F only diagram