Searching for Signal

the n01se blog

how to use a custom theme in rx4rdf

I've started experimenting with rx4rdf, and although there are more useful things I could do first, I started trying to replace the default visual theme with a custom one just for After much stumbling around, I found what I needed to add to the file in order for my own XSLT (really RxSLT) and CSS stylesheets to work.

First I used __addItem__ to make rx4rdf aware of the two new stylesheet files, and how to treat each of them:

  __addItem__('n01senet-theme.xsl', loc="path:n01senet-theme.xsl",

  __addItem__('n01senet-theme.css', loc="path:n01senet-theme.css",
    format='text', disposition='complete'),

The server will now expect to find those files in my site's "content" directory.

Next I created a new "theme" made up of those two stylesheets:

  __addRxML__(replace = '@themes', contents = '''
    a: wiki:SiteTheme
    wiki:uses-css-stylesheet: base:n01senet-theme.css
    wiki:uses-site-template-stylesheet: base:n01senet-theme.xsl
    rdfs:comment: `custom theme for

Note by using "replace =" above, I disabled the three themes that ship with rx4rdf. That's ok with me, since I won't be needing them for this site.

Finally, I configured my sitevars to point to the new theme:

  __addRxML__(replace = '@sitevars', contents = '''
    wiki:header-image: `n01senet-logo2.png
    #wiki:header-text: ` rocks!
    wiki:footer-text: `© 2007
    wiki:uses-theme: base:n01senet-theme
    #wiki:uses-skin:  base:skin-lightblue.css

I also commented out the uses-skin predicate because I don't need another CSS file included.

This may not be the best way to do this, but since I couldn't find any existing documentation on how it should be done, I thought it would be worth writing up what worked for me.

I started off with n01senet-theme.css and .xsl files copied from rx4rdf-0.6.0/rhizome/themes/default/theme.css and .xsl files, and started modifying them to look like I want. I'm not done yet, but it looks like I'll have all the flexibility I need (a.k.a. enough rope to hang myself)