You can split the text into words by inserting zero-width space characters (U+200B, HTML entity ​), then the line breaks will occur at these positions:
<xsl:template name="split_value">
<xsl:param name="value"/>
<xsl:param name="max_length"/>
<xsl:variable name="ret">
<xsl:value-of select="substring($value, 1, $max_length)"/>
<xsl:if test="string-length($value) > $max_length">
<xsl:value-of select="'​'"/>
<xsl:call-template name="split_value">
<xsl:with-param
name="value"
select="substring($value, $max_length + 1)"
/>
<xsl:with-param
name="max_length"
select="$max_length"
/>
</xsl:call-template>
</xsl:if>
</xsl:variable>
<xsl:value-of select="$ret"/>
</xsl:template>
Note: you might want to enhance the template so that it splits only pieces of text where no whitespace occurs between $max_length continuous characters.
Here's a test case.
Input XML:
<data>0123456789</data>
Stylesheet (generates HTML):
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
exclude-result-prefixes="xsl"
>
<xsl:template match="/">
<html>
<body
style="font-family: Arial; font-size: 12pt; font-weight: normal"
>
<table width="4cm">
<xsl:for-each select="/data">
<tr><td>
<xsl:call-template name="split_value">
<xsl:with-param
name="value"
select="text()"
/>
<xsl:with-param
name="max_length"
select="number(4)"
/>
</xsl:call-template>
</td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>