# Best way to render KML files using RXML templates

**URL:** <https://www.ruby-forum.com/t/best-way-to-render-kml-files-using-rxml-templates/107853>\
**Category:** Rails\
**Created:** [June 26, 2007, 10:09pm UTC](https://www.ruby-forum.com/t/best-way-to-render-kml-files-using-rxml-templates/107853 "2007-06-26T22:09:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![martinlooker](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/54ee81/32.png) [@martinlooker](https://www.ruby-forum.com/u/martinlooker)\
**Post date:** [June 26, 2007, 10:09pm UTC](https://www.ruby-forum.com/t/best-way-to-render-kml-files-using-rxml-templates/107853/1 "2007-06-26T22:09:30Z")

</div>

I want to produce google maps KML files which are baiscally XML files  
with a KML extention. I’m using restful routes and respond\_to. The  
best way I’ve found is to use

respond\_to do |format|  
format.kml { render :action =\> “kml” }

will render a kml.rxml template I have but really I want to have  
action.rxml rendered for kml files.

Is there are way to acheive this, or add an extra extension like  
action.kml.rxml that can be picked up ?

Should I be using register\_template\_handler(“kml”, ???) and specify  
whichever existing class handles the rxml template handling and use  
action.rkml for my templates ?

Any pointers would be really helpful.
