-1

我正在使用Diazo(以前称为 XDV)来主题一些内部网站,使用 Apache 和mod_transform_htmlTransformSet我希望我可以通过将指令放入指令中来利用多个不同的主题Location,如下所示:

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

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

不幸的是,看起来总是优先的TransformSet指令。/我暂时通过将内容从/to移动/main并添加来解决这个问题:

RewriteRule ^/$ /main/ [R]

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

这行得通,但我宁愿能够将这个内容托管在/.

那么......有没有办法覆盖应用于的转换/?这种事情似乎适用于其他 Apache 配置指令(例如,ProxyPass)。

4

1 回答 1

0

我从来没有完成对 mod_transform 的参数支持,但是如果您可以根据页面内容在主题之间进行选择,那么您可以使用以下内容:

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

这提醒我应该添加一个 if-not-content 以便您可以在那里使用 css 选择器。有关更多信息,请参阅:http ://diazo.org/advanced.html#multiple-conditional-themes

尽管仅将 LocationMatch 用于根主题可能会更容易,例如:

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

这将避免两个 TransformSet 指令应用于同一请求。

于 2011-10-27T20:44:02.577 回答