Thanks Michael, that is quite concise.

Sent from my iPhone

On 5 Sep 2010, at 22:22, Michael Kay <mike@saxonica.com> wrote:

An alternative approach you might like to consider is along the lines of:

<xsl:for-each-group select="string-to-codepoints($line)" group-adjacent="position() idiv $line-size">
  <line><xsl:value-of select="codepoints-to-string(current-group())"/></line>
</xsl:for-each>

Michael Kay
Saxonica

On 05/09/2010 3:35 PM, Meeraj Kunnumpurath wrote:
Hi,

I have written one myself, assuming there is not one available in the core functions.

    <xsl:function name="gpg:split">
        <xsl:param name="line" />
        <xsl:param name="line-size" />
        <xsl:param name="current-line" />
        <xsl:param name="max-lines" />
        <xsl:if test="string-length($line) &lt;= $line-size and $current-line &lt; $max-lines">
            <xsl:value-of select="$line" />
            <xsl:text>&#10;</xsl:text>
        </xsl:if>
        <xsl:if test="string-length($line) > $line-size and $current-line &lt; $max-lines">
            <xsl:value-of select="substring($line, 0, $line-size + 1)" />
            <xsl:text>&#10;</xsl:text>
            <xsl:value-of select="gpg:split(substring($line, $line-size + 1, string-length($line)), $line-size, $current-line + 1, $max-lines)" />
        </xsl:if>
    </xsl:function>

Thanks
Meeraj

On Sun, Sep 5, 2010 at 3:24 PM, Florent Georges <lists@fgeorges.org> wrote:
Meeraj Kunnumpurath wrote:

 Hi,

> Is there an extension function to split a line based on number
> of characters up to a specified number of lines?

 Why do you want an extension function for that?

 Regards,

--
Florent Georges
http://fgeorges.org/





------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
saxon-help@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/saxon-help

------------------------------------------------------------------------------ This SF.net Dev2Dev email is sponsored by: Show off your parallel programming skills. Enter the Intel(R) Threading Challenge 2010. http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________ saxon-help mailing list archived at http://saxon.markmail.org/ saxon-help@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/saxon-help

------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
saxon-help@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/saxon-help