Subject: [xsl] Mutability of variables From: Meeraj Kunnumpurath <mkunnumpurath@xxxxxxxxxxxxxx> Date: Wed, 22 Sep 2010 13:47:25 +0100 |
Hi, I realize XSLT variables are immutable. However, I have a requirement to split a piece of text into multiple lines based on a pre-defined length respecting word boundaries. This means if the last word on a line doesn't fit into the current line, the whole word needs to be moved into a new line. I am using XSLT 2.0 with Saxon 9.* HE. My initial thinking was to do something like below, without using recursion <xsl:function name="gpg:split-name-1"> <xsl:param name="line" /> <xsl:for-each select="tokenize(normalize-space($line), ' ')"> // Keep track of the current length and introduce a break and reset the length when the length exceeds the max line length </xsl:for-each> </xsl:function> However, since the variables are immutable, I am unable to keep track of the current length. Is there a way to do this using standard XSLT 2.0 constructs and not using recursion? Kind regards Meeraj
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] String manipulation XSLT , pankaj . c | Thread | RE: [xsl] Mutability of variables, Ludwig, Michael |
[xsl] String manipulation XSLT 1.0, pankaj . c | Date | Re: [xsl] String manipulation XSLT , Martin Honnen |
Month |