Error Theme Inherited from Barceloneta footer_portlets_count


I am trying to theme Plone following

After creating a new theme that inherits from Barceloneta, I am getting the following error after reloading the home page of the site:

runtime error, element 'if' [148:0]
Variable 'footer_portlets_count' has not been declared. [0:0]
Undefined variable [0:0]

The rules xml displayed after the above three lines that include the string footer_portlets_count are the following:

<xsl:variable name="footer_portlets_count" select="count($footer_portlets)"/>

after "Footer" section


<xsl:if test="$footer_portlets_count=1">col-md-12</xsl:if>
<xsl:if test="$footer_portlets_count=2">col-md-6</xsl:if>
<xsl:if test="$footer_portlets_count=3">col-md-4</xsl:if>
<xsl:if test="$footer_portlets_count=4">col-md-3</xsl:if>
<xsl:if test="$footer_portlets_count>4">col-md-4</xsl:if>

after "Move all other footer portlets into doormat area." section

I think all these come from Barceloneta.

Any ideas?



I use the following for the replacement:

<!-- Central column with Right Portlets if available -->
<replace css:theme=".content-container" method="raw">
  <xsl:variable name="central">                
    <xsl:if test="//aside[@id='portal-column-two']">col-md-9</xsl:if>                
    <xsl:if test="not(//aside[@id='portal-column-two'])">col-md-12</xsl:if>
  <xsl:variable name="right">
    <xsl:if test="//aside[@id='portal-column-two']">col-md-3</xsl:if>
    <xsl:if test="not(//aside[@id='portal-column-two'])">col-md-6</xsl:if>
  <div class="container content-container">
    <div class="row">
      <!-- Main Content -->
      <div class="{$central}">
        <!--- ..... -->
      <!-- /Main Content -->
      <!-- Right Slot -->
      <div class="{$right}">
        <!--- ..... -->
      <!-- /Right Slot -->

I have never seen the 'count'… is it documented somewhere ?
What happens if you declare the variable as:

<xsl:variable name="footer_portlets_count">3</xsl:variable>

Completely unrelated, but you could consider using CSS flex or CSS grid and do it all with CSS (that is what I do)

If i see correctly the $footer_portlets variable is missing .... see the rules.xml on barceloneta master here

I just ran into this issue and solved it as follows:

  1. replace the filesystem barceloneta theme with a TTW version
  2. in the ttw version, find rules.xml and cut out the section marked with <!-- Footer --> in lines 104-107
  3. paste the two xsl variable definitions footer_portlets and footer_portlets_count below the line <replace css:theme-children="#portal-footer .doormat"> near line 126
  4. rename index.html in your custom theme to theme-index.html
  5. copy index.html from barceloneta to index.html in your custom theme
  6. use the following rules.xml
<?xml version="1.0" encoding="UTF-8"?>
<rules xmlns=""
  <rules css:if-content="body:not(.userrole-anonymous)">
    <!-- Import Barceloneta rules -->
    <xi:include href="++theme++barceloneta/rules.xml"
    <after css:theme-children="head">
      <link rel="stylesheet"
  <rules css:if-content="body.userrole-anonymous">
    <theme href="theme-index.html"
    <!-- your customizations go here -->

Note: on Plone 5.2 RC4 you will run into this issue when overriding barceloneta:

Plone Foundation Code of Conduct