I have a function that adds a zero-width characters. It's not quite working the way I want it to though. How do I get it to add the zero-space character every 15 chars only if it does not contain a normal space?
<xsl:template match="text()[parent::d:entry]">
<xsl:call-template name="intersperse-with-zero-spaces">
<xsl:with-param name="str" select="."/>
<xsl:with-param name="max_length" select="number(15)"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="intersperse-with-zero-spaces">
<xsl:param name="str"/>
<xsl:param name="max_length"/>
<xsl:variable name="ret">
<xsl:value-of select="substring($str, 1, $max_length)"/>
<xsl:if test="string-length($str) > $max_length">
<xsl:value-of select="'​'"/>
<xsl:call-template name="intersperse-with-zero-spaces">
<xsl:with-param name="str" select="substring($str, $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>