如何从插入重氮主题的插件转换内容块 [英] How to transform block of content from plone being inserted into diazo theme
问题描述
我正在将重氮(Plone 4.1)用于重氮(目前是plone.app.theme,名称为1.0b1-r48205).除了要使用<button>
替换用于搜索小部件中搜索按钮的<input>
元素外,我想完全使用Plone的html作为搜索小部件. diazo文档似乎建议您可以这样做.
I'm using a diazo (currently plone.app.theming 1.0b1-r48205) with Plone 4.1. I want to use exactly Plone's html for the search widget except that I'd like to replace <input>
element used for the search button in the search widget with a <button>
. The diazo docs seem to suggest you can do this.
在主题HTML文件中,我有一个空的<div id="portal-searchbox"></div>
.在我的rules.xml中,我具有以下内容:
In my theme html file I have an empty <div id="portal-searchbox"></div>
. In my rules.xml I have the following:
<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>
我已经尝试过许多变种,但都没有成功.任何帮助将非常感激.
I've tried numerous variations of this but with no success. Any help would be much appreciated.
推荐答案
好的,因此以下工作有效.之前无法正常工作的原因是<xsl:template>
不在根级规则标记中(那里有一个文档错误). <xsl:template>
必须位于根级别规则标记中,因为当前无法将规则条件应用于<xsl:template>
.
Ok, so the following works. The reason it wasn't working before was that the <xsl:template>
was not in the root level rules tag (there's a documentation bug there). The <xsl:template>
must be in the root level rules tag because there is no way to apply rule conditions to an <xsl:template>
currently.
<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"/>
更新:我在Diazo中添加了对<replace content="...">
的支持,因此不推荐使用内联<xsl:template>
.而是使用:
Update: I've added support for <replace content="...">
to Diazo, so inline <xsl:template>
's are considered deprecated. Instead use:
<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"/>
位于 http://diazo.org/advanced的文档. html#modifying-the-content-on-fly
这篇关于如何从插入重氮主题的插件转换内容块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!