CGI can support nearly any language. So if C is more comfortable to you, feel free to use it to develop the CGI application. Just do some reading on XML/XSLT and write your CGI program. Just make sure Apache can use it. For more details, see the Apache documentation on CGI.
libxml2/libxslt is a popular XML/XSLT combo for C:
http://xmlsoft.org/
There are examples on that site, but I guess more is available if you do a Web search.
If you use PHP or Perl, basically you will also be using libxml2/libxslt as well.
PHP5 DOM API+XSLT:
http://www.php.net/manual/en/ref.dom.php
Perl: There is a good article on Perl XML at
http://www.xml.com/pub/a/2001/04/18/perlxmlqstart1.html
I prefer PHP5 over Perl for XSLT.
You should find articles at
http://www.xml.com useful if you are not that experienced with XML, XMLNS, XSLT and related stuff. As I said, there are just many ways, and you will need to decide on which one to take.