xsl-list
[Top] [All Lists]

Re: [xsl] Line break algorithm

2020-05-02 20:05:31
You could have a look at this -- just add the break at the end of each
generated line:

https://github.com/dnovatchev/FXSL-XSLT2/blob/master/f/strSplit-to-Lines.xsl


This solution was posted in the xsl-list in 2002:

https://www.oxygenxml.com/archives/xsl-list/200202/msg01247.html


Cheers,
Dimitre

On Sat, May 2, 2020 at 5:45 PM Rick Quatro rick(_at_)rickquatro(_dot_)com <
xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> 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
Airports'"/>



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



Rick Quatro

Carmen Publishing Inc.

rick(_at_)frameexpert(_dot_)com

585-729-6746

www.frameexpert.com/store/
XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list>
EasyUnsubscribe <http://lists.mulberrytech.com/unsub/xsl-list/782854> (by
email <>)



-- 
Cheers,
Dimitre Novatchev
---------------------------------------
Truly great madness cannot be achieved without significant intelligence.
---------------------------------------
To invent, you need a good imagination and a pile of junk
-------------------------------------
Never fight an inanimate object
-------------------------------------
To avoid situations in which you might make mistakes may be the
biggest mistake of all
------------------------------------
Quality means doing it right when no one is looking.
-------------------------------------
You've achieved success in your field when you don't know whether what
you're doing is work or play
-------------------------------------
To achieve the impossible dream, try going to sleep.
-------------------------------------
Facts do not cease to exist because they are ignored.
-------------------------------------
Typing monkeys will write all Shakespeare's works in 200yrs.Will they write
all patents, too? :)
-------------------------------------
Sanity is madness put to good use.
-------------------------------------
I finally figured out the only reason to be alive is to enjoy it.
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--
<Prev in Thread] Current Thread [Next in Thread>