I'm assuimg you want to take a digital signal IN, and output to analog out? If so, its doable, with a minor caveat:
No soundcard will decode a 5.1 DD/DTS signal from Digital IN to Analog OUT. Technically, Creatives cards has a DD/DTS decoder on board, but apparently, it won't decode a Digital->Analog signal (according to a few people I've talked to, you can do this in XP, although I haven't tested yet...). And since Optical Digital can only carry a 5.1 signal encoded in DD/DTS (due to DRM issues), unless you have a seperate decoder to route through, the best you can get is 2 channel uncompressed PCM.
Most soundcards will take a digital signal (most of Creatives and ASUS's; even the Razer Barracuda can do this), its just only Creative has a decoder for DD/DTS signals, and that won't work going from digital to analog.
In short, unless you go through a decoder first, the best you can get is 2.0 sound over optical digital.