gpt4 book ai didi

xslt - 已启用使用 Diazo 主题将类添加到正文标签

转载 作者:行者123 更新时间:2023-12-04 12:48:32 28 4
gpt4 key购买 nike

我想知道如何使用带有主题的 Diazo 向 body 标签添加一个类。
我会用 if-content检查是否 portal-column-two存在与否,并根据此将一个类放入 body 标记中。

一种解决方案是:

<replace theme="/html/body/@class">
<xsl:attribute name="class"><xsl:copy-of select="." /> three_col</xsl:attribute>
</replace>

并在此处描述:
Add class to body tag using diazo with notheme但只有在设置了 notheme 时才有效。

那么如何将一个简单的附加 css 类即时放入 body 标签中呢?

编辑:
这适用于带有主题的纯 Diazo 和 Plone (plone.app.theming):
<before theme-children="/html/body"><xsl:attribute name="class"><xsl:value-of select="/html/body/@class" /> three_col</xsl:attribute>
</before>

并根据条件:
<before theme-children="/html/body" css:if-content="#portal-column-two">
<xsl:attribute name="class"><xsl:value-of select="/html/body/@class" /> three_col</xsl:attribute>
</before>
<before theme-children="/html/body" css:if-not-content="#portal-column-two">
<xsl:attribute name="class"><xsl:value-of select="/html/body/@class" /> two_col</xsl:attribute>
</before>

我的最终解决方案描述如下: https://plone-theming-with-diazo.readthedocs.org/en/latest/snippets_diazo/recipes/index.html#add-css-class-depending-on-existing-portal-columns

最佳答案

关于xslt - 已启用使用 Diazo 主题将类添加到正文标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13420114/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com