I use Diazo with Plone and have some xsl code that works in the root of rules.xml, but not inside the attached XML file. I would like to keep my rules. Xml is simple and keep the style of the section in each .xml file of each section.
How to add class "subNav" to all li using diazo from section-one.xml?
Doesn't work (but preferably):
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>
section-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>
Work (but not desirable):
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> <xsl:template match="//body[contains(@class, 'section-one')]//li"> <xsl:copy> <xsl:attribute name="class">subNav</xsl:attribute> <xsl:apply-templates /> </xsl:copy> </xsl:template> </rules>
section-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"/> </rules>
source share