Re: [xsl] Line break algorithm

Subject: Re: [xsl] Line break algorithm
From: "Eliot Kimber ekimber@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 4 May 2020 14:06:52 -0000
For a more complete i18n-aware solution I integrated ICU4J's word and line
break features into Saxon extensions in my DITA Community i18n project:

While this is set up to integrate with the DITA Open Toolkit, the Saxon
extensions are generic and should be useful in any Saxon context. Note that I
haven't touched this code since before Saxon 10 was released so it might need
a little attention, so if you try it and find an issue, don't hesitate to log
an issue.



Eliot Kimber

o;?On 5/2/20, 7:45 PM, "Rick Quatro rick@xxxxxxxxxxxxxx"
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:

    Hi All,

    I have lines in my input that I want to add <break> elements to in my
output. For example, this might be the input:

    <xsl:param name="line" select="'Takeoff from Unlisted and Alternate

    and I want to replace a space with a <break> so that each line doesn't
exceed, for example, 35 characters

    <line>Takeoff from Unlisted and Alternate<break/>Airports</line>

    I am thinking the I can tokenize the line and then recursively build the
string back up from the beginning, checking its length. Any other suggestions
on a general-purpose algorithm that I can use in XSLT 3 would be appreciated.
Thanks in advance.


    Rick Quatro
    Carmen Publishing Inc.
    585-729-6746 <>

    XSL-List info and archive
    (by email <>)

Current Thread