我正在使用带有Plone 4.1的重氮(目前是plone.app.theming 1.0b1-r48205).我想将Plone的html用于搜索小部件,除了我想用搜索小部件替换<input>用于搜索小部件的搜索按钮的元素<button>.该重氮文档似乎表明你可以做到这一点.
在我的主题html文件中,我有一个空的<div id="portal-searchbox"></div>.在我的rules.xml中,我有以下内容:
<rules if-content="$enabled">
<replace css:theme="div#portal-searchbox">
<xsl:apply-templates css:select="div#portal-searchbox" />
</replace>
<xsl:template css:match="div#portal-searchbox input.searchButton">
<button type="submit"><img src="images/search.png" alt="Search" /></button>
</xsl:template>
</rules>
Run Code Online (Sandbox Code Playgroud)
我已经尝试了很多变化,但没有成功.任何帮助将非常感激.
好的,所以以下工作.之前没有工作的原因是它不在<xsl:template>根级别规则标签中(那里有文档错误).在<xsl:template>必须在根级别规则的标签,因为没有办法规则条件适用于<xsl:template>目前.
<xsl:template css:match="div#portal-searchbox input.searchButton">
<button type="submit"><img src="images/search.png" alt="Search" /></button>
</xsl:template>
<replace css:theme="div#portal-searchbox" css:content="div#portal-searchbox"/>
Run Code Online (Sandbox Code Playgroud)
更新:我已经添加了<replace content="...">对Diazo的支持,因此内联<xsl:template>的被认为已被弃用.而是使用:
<replace css:content="div#portal-searchbox input.searchButton">
<button type="submit"><img src="images/search.png" alt="Search" /></button>
</replace>
<replace css:theme="div#portal-searchbox" css:content="div#portal-searchbox"/>
Run Code Online (Sandbox Code Playgroud)
http://diazo.org/advanced.html#modifying-the-content-on-the-fly上的文档