我正在使用Diazo(以前的XDV)使用Apache和mod_transform_html来主题一些内部网站。我希望通过在TransformSet
指令中放置Location
指令来使用多个不同的主题,如下所示:
<Location /blog/>
TransformSet /themes/blog.xsl
</Location>
<Location />
TransformSet /themes/main.xsl
</Location>
不幸的是,看起来TransformSet
的{{1}}指令始终优先。我暂时通过将内容从/
移到/
并添加:
/main
这样可行,但我希望能够托管以RewriteRule ^/$ /main/ [R]
<Location /main/>
TransformSet /themes/main.xsl
</Location>
为根的内容。
那么......有没有办法覆盖应用于/
的转换?这种事情似乎适用于其他Apache配置指令(例如,/
)。
答案 0 :(得分: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指令应用于同一个请求。