重氮 - 替换css属性

Her*_*sua 2 plone diazo

我试图用Diazo replaceattributes规则替换一些CSS样式,但到目前为止我还没弄清楚.

到目前为止,我一直在使用重氮成功replace,copy,before,after,drop为规则css:content,css:theme,css:content-children,和css:theme-children.

我目前的标记基于Twitter Bootstrap 3.0,如下所示:

<div class="container">
    <div class="row">
        <div id="content" class="col-md--8 well">
            <p>Plone content here</p>
        </div>
    </div>
</div>
Run Code Online (Sandbox Code Playgroud)

使用drop规则我可以​​删除我的类#content:

<drop attributes="class" css:theme="#theme"/>
Run Code Online (Sandbox Code Playgroud)

但我无法弄清楚如何添加css类col-12.col-12在我的主题中不存在任何地方.到目前为止,我已经尝试了以下规则:

<replace attributes="class col-12" css:theme="#theme"/>
<replace attributes="col-12" css:theme="#theme"/>
Run Code Online (Sandbox Code Playgroud)

我有一个copy规则的例子,href从Plone复制链接#portal-logo:

<copy attributes="href" css:content="#portal-logo" css:theme="#logo" />
Run Code Online (Sandbox Code Playgroud)

我觉得我很亲近,我所需要的只是一个类似的例子.我一直在寻找Diazo docs for Basic语法,但还没有能够解决这个问题.

任何帮助将不胜感激,如果我在得到答复之前弄明白,我会更新我的问题

谢谢.

Vit*_*ito 6

通常我使用这个规则将森伯斯特网格"映射"到bootstrap(2):

<replace content="//div[contains(@class,'cell')]/@class">
<xsl:attribute name="class">
<xsl:if test='contains(current(),"width-3:4")'>span9</xsl:if>
<xsl:if test='contains(current(),"width-2:3")'>span8</xsl:if>
<xsl:if test='contains(current(),"width-1:2")'>span6</xsl:if>
<xsl:if test='contains(current(),"width-1:3")'>span4</xsl:if>
<xsl:if test='contains(current(),"width-1:4")'>span3</xsl:if>
<xsl:if test='contains(current(),"width-full")'>span12</xsl:if>
</xsl:attribute>
</replace>
Run Code Online (Sandbox Code Playgroud)

希望这有帮助.

维托