我正在使用带有Plone的Diazo并且有一些xsl代码在rules.xml的根目录中工作,但不在包含的.xml文件中.我想保持我的rules.xml简单,并在每个部分的.xml文件中保留部分特定的样式.
如何使用section-one.xml中的diazo将类"subNav"添加到所有li?
不工作(但需要):
rules.xml中
<?xml version="1.0" encoding="UTF-8"?>
<rules
xmlns="http://namespaces.plone.org/diazo"
xmlns:css="http://namespaces.plone.org/diazo/css"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xi="http://www.w3.org/2001/XInclude">
<rules if-path="section-one/">
<xi:include href="section-one.xml" />
<theme href="templates/section-one.html" />
</rules>
<rules if-not-path="section-two/">
<xi:include href="section-two.xml" />
<theme href="templates/section-two.html" />
</rules>
</rules>
Run Code Online (Sandbox Code Playgroud)
科one.xml
<?xml version="1.0" encoding="UTF-8"?>
<rules
xmlns="http://namespaces.plone.org/diazo"
xmlns:css="http://namespaces.plone.org/diazo/css"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xi="http://www.w3.org/2001/XInclude">
<replace css:content="#content" css:theme="#content"/>
<xsl:template match="//li">
<xsl:copy>
<xsl:attribute name="class">subNav</xsl:attribute>
<xsl:apply-templates />
</xsl:copy>
</xsl:template>
</rules>
Run Code Online (Sandbox Code Playgroud)
工作(但不是想要):
rules.xml中
<?xml version="1.0" encoding="UTF-8"?>
<rules
xmlns="http://namespaces.plone.org/diazo"
xmlns:css="http://namespaces.plone.org/diazo/css"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xi="http://www.w3.org/2001/XInclude">
<rules if-path="section-one/">
<xi:include href="section-one.xml" />
<theme href="templates/section-one.html" />
</rules>
<rules if-not-path="section-two/">
<xi:include href="section-two.xml" />
<theme …Run Code Online (Sandbox Code Playgroud)