Reputation: 169
I found this piece of code which wraps the data inside a cell ,but it doesn't take into account the word i.e if the complete word cannot be fitted in the line ,It doesn't change the line .It writes few alphabets before changing the line .
What should I modify in this code so that If a particular word is not getting adjusted in the line , it changes the line .
Also , I am new to xsl -fo .I have understood most of the code ,but would appreciate if a little could be explained .
<xsl:template name="zero_width_space_1">
<xsl:param name="data"/>
<xsl:param name="counter" select="0"/>
<xsl:choose>
<xsl:when test="$counter < string-length($data)">
<xsl:value-of select='concat(substring($data,$counter,1),"​")'/>
<xsl:call-template name="zero_width_space_2">
<xsl:with-param name="data" select="$data"/>
<xsl:with-param name="counter" select="$counter+1"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="zero_width_space_2">
<xsl:param name="data"/>
<xsl:param name="counter"/>
<xsl:value-of select='concat(substring($data,$counter,1),"​")'/>
<xsl:call-template name="zero_width_space_1">
<xsl:with-param name="data" select="$data"/>
<xsl:with-param name="counter" select="$counter+1"/>
</xsl:call-template>
</xsl:template>
and then placing a call to zero_width_space_1 like following-
<xsl:call-template name="zero_width_space_1">
<xsl:with-param name="data" select="span"/>
</xsl:call-template>
for ex - "I found this piece of code which wraps the data inside a cell "..It shows as in a cell as
I found th
is piece o
f code whi
ch wraps t
he data in
side a cel
l
Upvotes: 2
Views: 1289
Reputation: 169
Wrapping is provided by the cells automatically . Zero_width_space includes a zero-width space after every character ,so better to not call this template if the requirement is not filling the cells character wise .
Upvotes: 2