I am exporting to pdf a table generated at run time in Oracle APEX, using XSL-FO for the report query template. Unfortunately, long words inside cells are not wrapped and they overlap the adjacent cell, making the report really ugly and useless. How can this be solved? NOTE: I am aware that this questions has already been asked many times. My problem is that none of the solutions I have found seems to work. In particular, I am implementing what I found here: XSL-FO: Force Wrap on Table Entries
With this solution, nothing is happening. I tried inserting a command for red text inside the template, to check if it was working, but the answer is no. You can see I tried using "hyphenate" and "wrap-option" too, as seen in other answers to the problem, but with no success. How can I fix this? Is the template for "intersperse-with-zero-spaces" put in the right position?
This is my code:
<xsl:stylesheet xmlns:fox="http://xml.apache.org/fop/extensions" xmlns:fo="http://www.w3.org/1999/XSL/Format" version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:saxon="http://icl.com/saxon" extension-element-prefixes="saxon" >
<xsl:variable name="_XDOFOPOS" select="''"/>
<xsl:variable name="_XDOFOPOS2" select="number(1)"/>
<xsl:variable name="_XDOFOTOTAL" select="number(1)"/>
<xsl:variable name="_XDOFOOSTOTAL" select="number(0)"/>
<!-- VARIOUS OTHER ATTRIBUTES HERE -->
<xsl:attribute-set name="cell">
<xsl:attribute name="background-color">#BODY_BG_COLOR#</xsl:attribute>
<xsl:attribute name="color">#BODY_FONT_COLOR#</xsl:attribute>
<xsl:attribute name="padding-start">5.15pt</xsl:attribute>
<xsl:attribute name="vertical-align">top</xsl:attribute>
<xsl:attribute name="padding-top">0.0pt</xsl:attribute>
<xsl:attribute name="padding-end">5.15pt</xsl:attribute>
<xsl:attribute name="number-columns-spanned">1</xsl:attribute>
<xsl:attribute name="height">0.0pt</xsl:attribute>
<xsl:attribute name="padding-bottom">0.0pt</xsl:attribute>
<xsl:attribute name="font-style">italic</xsl:attribute>
<xsl:attribute name="color">blue</xsl:attribute>
<xsl:attribute name="hyphenate">true</xsl:attribute>
<xsl:attribute name="wrap-option">wrap</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="header-color">
<xsl:attribute name="background-color">#HEADER_BG_COLOR#</xsl:attribute>
<xsl:attribute name="color">#HEADER_FONT_COLOR#</xsl:attribute>
</xsl:attribute-set>
<!-- Trying this to wrap long words -->
<xsl:template match="text()">
<xsl:call-template name="intersperse-with-zero-spaces">
<xsl:with-param name="str" select="."/>
<xsl:attribute name="color">red</xsl:attribute>
</xsl:call-template>
</xsl:template>
<xsl:template name="intersperse-with-zero-spaces">
<xsl:param name="str"/>
<xsl:variable name="spacechars">
	

      
     ​
</xsl:variable>
<xsl:if test="string-length($str) > 0">
<xsl:variable name="c1" select="substring($str, 1, 1)"/>
<xsl:variable name="c2" select="substring($str, 2, 1)"/>
<xsl:value-of select="$c1"/>
<xsl:if test="$c2 != '' and
not(contains($spacechars, $c1) or
contains($spacechars, $c2))">
<xsl:text>​</xsl:text>
</xsl:if>
<xsl:call-template name="intersperse-with-zero-spaces">
<xsl:with-param name="str" select="substring($str, 2)"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<!-- long word wrap end -->
<xsl:template match="DOCUMENT">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<!-- OTHER STUFF AND THE TABLE ... -->
</fo:root>
</xsl:template>
</xsl:stylesheet>