Respond to different format

Hi,

I am now developing an application that require a function that output
the format corrspending to the request required, such as if browser
request html, it respond the data in html format, and output the csv
formated file when client is requesting the csv presentation of data.

I am currently using the respond_to block to enclose this dispatching
of the different output requested from client. On Rails, it support to
specify the html as parse from rhtml, but how to let rails to specify
csv for output? and how to make a template for outputting csv like
rhtml output html ?

Thank,
Patrick