Diazo + Apache + mod_transform: theming `/` different from other paths

324 Views Asked by At

I'm using Diazo (formerly XDV) to theme some internal websites, using Apache and mod_transform_html. I was hoping I could make use of multiple distinct themes by putting TransformSet directives inside Location directives, like this:

<Location /blog/>
   TransformSet /themes/blog.xsl
</Location>

<Location />
   TransformSet /themes/main.xsl
</Location>

Unfortunately, it looks like the TransformSet directive for / always takes precedence. I've solved this for the time being by moving content from / to /main and adding:

RewriteRule ^/$ /main/ [R]

<Location /main/>
   TransformSet /themes/main.xsl
</Location>

This works, but I would rather be able to host this content rooted at /.

So...is there a way to override a transformation applied to /? This sort of thing seems to work for other Apache configuration directives (e.g., ProxyPass).

1

There are 1 best solutions below

5
On BEST ANSWER

I never got around to finishing the paramater support for mod_transform, but if you can choose between themes based on page content, then you could use something like:

<rules css:if-content="#blog">
  <theme href="blog.html"/>
  ...
</rules>
<rules if="not(//*[@id='blog']">
  <theme href="main.html"/>
  ...
</rules>

This reminds me I should add an if-not-content so you can use a css selector there. For more, see: http://diazo.org/advanced.html#multiple-conditional-themes

It might be easier though just to use LocationMatch instead for the root theme, something like:

<LocationMatch "/(?!blog)">
   TransformSet /themes/main.xsl
</LocationMatch>

That would avoid both TransformSet directives applying to the same request.