You mention Apache and Perl. But are you using mod_perl? In which case AxKit might be a good bet. If not, take a look at CGI::XMLApplication, and also see Kip Hampton's recent articles on XML.com talking about that module.
If you go the AxKit route, look into XSP, specifically AxKit::XSP::ESQL (on CPAN) for doing SQL. If you go the CGI::XMLApplication route, check out XML::Generator::DBI and XML::LibXML::SAX::Builder to build a DOM from the results, and pass it to XML::LibXSLT for transformation.
Probably sounds like an overwhelming number of options. So let me know if you want further details!
<code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>