Updating HTML page through AJAX with XML response and XSL

Dear List,

I have a problem with nicely integrating XML responses with AJAX into
a website. I did search the internet a lot but I did not find anything
too useful; so I hope that my question is neither stupid nor trivial.

What I try to do:
I have a ruby controller that produces some XML, say an RSS feed.
Then, I have a "standard" HTML site that should integrate this RSS
feed, e.g., by loading it from the server, applying some XSL
transformation, and putting it into a div.

It would be even better if it would then be possible to do some AJAX
magic, such as editing something which results in sending the changes
to the server, retrieving the XML again, applying the XSL
transformation and updating the page.

And it would be brilliant if it would also work into the other
direction: instead of transforming a form into HTTP parameters that
gets sent I would like to assemble some XML from it and send this. (by
using some standard javascript library, if possible)

The problem is, that the Ruby AJAX helpers (and the browser) just take
the XML as is and insert it into the site, without caring about any
xsl-stylesheet tag. (Which is funny, since AJAX is about XML, not
HTML:) Also, I want to (or have to) use XSL and not CSS, because I
don't know any way to transform e.g., an RSS link-tag into an HTML a-
link in CSS. But as I understood, todays browsers do not all allow to
perform XML transformations programmatically through javascript?

What I (kind of) managed to do is, to put some java script into
the :loaded option of a Rails link_to_remote call. (code see below).
This will load the xml and the xsl, do the transformation and append
it to the document. I know that for several reasons this is a very bad
piece of code, but it was meant to be a proof of concept.

My question to the community is now: Is there any elegant way to
actually use XML with AJAX? Or is it only meant to work with text and
maybe HTML snippets? (then I would like to make a request to remove
the X and replace it with an H instead...) Or is it just the easiest
to do the transformation on the server side? (which I wanted to avoid,
but whatever...)

Any pointers are highly appreciated!

Thanks in advance,
Christoph

--- bad and broken example: ---
<div id="p1" class="overview">
  <span class="title">Load RSS:
    <%= link_to_remote "do it",
      :update => 'p1-detail',
      :method => 'get',
      :url => '/feed/recipes',
      :loaded => "
        var XSLT = new XSLTProcessor;

        var $xml = new XMLHttpRequest;
        $xml.open('GET', '/feeds/recipe/2', false);
        $xml.overrideMimeType('text/xml');
        $xml.send(null);
        var xml = $xml.responseXML;

        var $xsl = new XMLHttpRequest;
        $xsl.open('GET', '/stylesheets/smb_rss2html.xsl', false);
        $xsl.overrideMimeType('text/xml');
        $xsl.send(null);
        var xsl = $xsl.responseXML;

        XSLT.importStylesheet(xsl);

        document.body.
        appendChild(XSLT.transformToFragment(xml, document));"%>
  </span>
</div>
<div id='p1-detail' class="rss"></div>

I like to be the first responder to my own questions:)

It turns out that I missed this thread:

http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/cf7ebb10fca27cbc/082baedc0c983757?lnk=gst&q=xml+xsl#

However, no real results there; make it server-side and don't rely on
xsl on the client. So I guess AJAH would be more appropriate. But
anyhow, maybe somebody has some great idea!?