# How to render RXML partial within a static XML file?

**URL:** <https://www.ruby-forum.com/t/how-to-render-rxml-partial-within-a-static-xml-file/114208>\
**Category:** Rails\
**Created:** [September 9, 2007, 10:58pm UTC](https://www.ruby-forum.com/t/how-to-render-rxml-partial-within-a-static-xml-file/114208 "2007-09-09T22:58:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mister\_Yu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/22d042/32.png) [@Mister\_Yu](https://www.ruby-forum.com/u/Mister_Yu)\
**Post date:** [September 9, 2007, 10:58pm UTC](https://www.ruby-forum.com/t/how-to-render-rxml-partial-within-a-static-xml-file/114208/1 "2007-09-09T22:58:13Z")

</div>

Hi,

there’s a big static part in the xml i want to output, can i do this  
in a “RHTML” way?

i tried to copy the static part and paste into the RXML template, but  
it didn’t work.

i tried to to do this inside my XMLController

1. def photos
2. 

```
@photos = Photo.find(:all, :limit => 3, :order => 'rand()')

```

3. 

```
render :template=>"photos.xml"

```

4. end

but it won’t work either. do i have to write the static part using the  
normal “xml.” way?

thank you.

---

<div class="post-metadata">

**Author:** ![Mister\_Yu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/22d042/32.png) [@Mister\_Yu](https://www.ruby-forum.com/u/Mister_Yu)\
**Post date:** [September 10, 2007, 9:18am UTC](https://www.ruby-forum.com/t/how-to-render-rxml-partial-within-a-static-xml-file/114208/2 "2007-09-10T09:18:09Z")

</div>

No you can write static content in your RXML file, just don’t write it  
as XML write it as RXML…

So you can do this:

for blah in @blahs  
xml.url do  
xml.loc(blah\_profile\_url(blah))  
xml.changefreq ‘daily’  
xml.lastmod((blah.updated\_at).strftime(“%Y-%m-%d”))  
xml.priority’0.8’  
end  
end

#Static content pages  
xml.url {  
xml.loc(‘[http://www.blah.com/about/blah](http://www.blah.com/about/blah)’)  
xml.changefreq(‘monthly’)  
xml.priority(‘0.3’)  
}  
xml.url {  
xml.loc(‘[http://www.blah.com/about/blahblah](http://www.blah.com/about/blahblah)’)  
xml.changefreq(‘monthly’)  
xml.priority(‘0.3’)  
}

But you can do this:  
for blah in @blahs  
xml.url do  
xml.loc(blah\_profile\_url(blah))  
xml.changefreq ‘daily’  
xml.lastmod((blah.updated\_at).strftime(“%Y-%m-%d”))  
xml.priority’0.8’  
end  
end  
  
[http://www.blah.com/about/blah](http://www.blah.com/about/blah)  
monthly  
0.3  
  
  
[http://www.blah.com/about/blah](http://www.blah.com/about/blah)  
monthly  
0.3

hope this helps,  
Cam
