Textareas not displaying existing content when my theme is enabled

It seems my theme has something missing which is affecting the administrative screens.
When I use the default barceloneta theme existing content of the textareas loads as expected. Any thoughts as to what might be the issue?

When the barceloneta theme is enabled all textareas load existing content as expected

when I enable my theme the textareas return blank, even when there is existing content,

Found the problem. My theme was actively omitting the content of textarea.

I had a xsl rule used to inject an additional class into my textareas, but it was not putting back the content of the textarea.
(BTW.. if you use the rules below in Diazo they must never be found in nested tags)

 <xsl:template match="//textarea">                                                
     <xsl:copy>
        <xsl:copy-of select="attribute::*[not(name()='class')]" />                 
        <xsl:attribute name="class"><xsl:value-of select="@class" />               
            <xsl:choose><xsl:when test="@class[contains(., 'blurrable')]">         
             blurrable
            </xsl:when>                                                            
            </xsl:choose>                                                          
            <xsl:choose><xsl:when test="@class[contains(., 'firstToFocus')]">      
            firstFocus                                                             
            </xsl:when>
            </xsl:choose>
                gl-textarea
        </xsl:attribute>                                                
    </xsl:copy>
</xsl:template>

The solution was to add the following line:

 <xsl:value-of select="." />   

Now the rule looks like this and everything works as expected.

 <xsl:template match="//textarea">                                                
     <xsl:copy>
        <xsl:copy-of select="attribute::*[not(name()='class')]" />                 
        <xsl:attribute name="class"><xsl:value-of select="@class" />               
            <xsl:choose><xsl:when test="@class[contains(., 'blurrable')]">         
             blurrable
            </xsl:when>                                                            
            </xsl:choose>                                                          
            <xsl:choose><xsl:when test="@class[contains(., 'firstToFocus')]">      
            firstFocus                                                             
            </xsl:when>
            </xsl:choose>
                gl-textarea
        </xsl:attribute>                                                           
        <xsl:value-of select="." />                                                
    </xsl:copy>
</xsl:template>
1 Like

For the sake of completeness I'm linking to this blog post. It discusses the use of <replace> instead of <xsl:template match>. <replace> offers the same functionality but generally can be used in nested rules.

Plone Foundation Code of Conduct