<xsl:template name="serna.fold.template"> <xsl:apply-templates select="." mode="serna.fold" xse:apply-serna-fold-template="false"/> </xsl:template> <!-- Default rule --> <xsl:template match="*" mode="serna.fold"> <se:fold se:fold=""/> </xsl:template>Note the xse:apply-serna-fold-template="false" attribute for xsl:apply-templates. It prohibits generation of fold templates for the children instances of apply-templates. Without it, Serna will call serna.fold.template recursively and will crash. It is also usually desirable to disable generation of fold templates also in places like tables of contents.
Custom folding templates MUST enclose all generated content into the single fo:block or fo:inline with the se:fold="" extension attribute. Serna determines boundaries of folded blocks by searching for this attribute. If it is not specified, Expand Command won't work.
In custom folding templates extension FO se:fold can be used explicitly, if single-click expand functionality is needed. Note that it also must be wrapped (with other content) as described above.
The se:fold FO can take the optional attribute show-element-name, whose value may be true or false. If show-element-name is false, then element name won't be shown in the se:fold widget.