I wanted to try out some things. Now i have tried to split a string into 100 blocks. So this is how far i gotten:
<xsl:template name="split100check">
<xsl:param name="input"></xsl:param>
<xsl:variable name="newInput" select="concat(normalize-space($input), ' ' )"></xsl:variable>
<xsl:variable name="start" select="substring($input, 1, 100)"></xsl:variable>
<xsl:variable name="end" select="substring($input, 101)"></xsl:variable>
<PART>
<xsl:value-of select="$start"></xsl:value-of>
</PART>
<xsl:if test="$end">
<xsl:call-template name="split100check">
<xsl:with-param name="input" select="$end"></xsl:with-param>
</xsl:call-template>
</xsl:if>9
</xsl:template>
So this does almost what i like to achieve. It takes a string into 100 blocks, but it splits also the words. For example :
<main>
<long>
A very long text here [....] only for test
</long>
</main>
Let's say the first 100 block ends at the word "only" but in the middle of it. so the first block would be "A very long text [....] on" and the second block "ly for test". So how do i need to build that template to do what i want ?
info : i can only use XSLT 1.0
Edit : To make it more clear an example with 10 blocks split :
Text: "Hello my friend" -> split it into 10blocks would be with my approach :
first block : <PART>Hello my f</PART>
second block : <PART>riend</PART>
I want the words to be not splited like this :
first block : <PART>Hello my </PART>
second block : <PARTR>friend </PART>
The first block ofc is now not anymore exactly 10 chars long but that does not matter. It shall put as many words as fit in a 10 chars block.
gz ALeks