我正在构建 plone 5 主题,并且有一个关于使用 rules.xml 替换嵌套 html 元素的问题。请查看结构,然后阅读最后的问题。
Plone5主题文件结构
index.html 页脚.html header.html
header_1.html header_2.html rules.xml
索引.html
这是我的默认主题页面。我必须 div 我希望它们被其他元素替换。
我在 rules.xml 中这样做。
...
<body>
<div id="header"/>
<div>my content. does not need to be replaced. static</div>
<div id="footer"/>
</body>
...
页脚.html
<div id="footer">
<div>This is your footer</div>
</div>
header.html
<div id="header">
<div>This is your header</div>
<div id="header_1"/>
<div id="header_2"/>
</div>
header_1.html
<div id="header_1">
<div>This is part 1 of your header</div>
</div>
header_2.html
<div id="header_2">
<div>This is part 2 of your header</div>
</div>
规则.xml
<rules
xmlns="http://namespaces.plone.org/diazo"
xmlns:css="http://namespaces.plone.org/diazo/css"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- in here I am replacing the footer. this works because there is not other elements inside
footer.html that needs to be replaced. -->
<replace
href="path/to/footer.html"
css:theme="#footer"
css:content="#footer"
method="document"
/>
***
RULE FOR REPLACING
header
header_1
header_2
</rules>
问题
如何为标题编写替换规则以首先替换作为标题的父级,然后在标题父级中替换 header_1 和 header_2。
我尝试了不同的方法来做到这一点,但我无法替换 header.html 中的元素。
基本上,rules.xml 具有加载标头并替换其元素,然后查看是否将规则应用于刚刚替换的元素。