xsl-list
[Top] [All Lists]

[xsl] Line break algorithm

2020-05-02 19:45:21
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 <mailto:rick(_at_)frameexpert(_dot_)com> 

585-729-6746

www.frameexpert.com/store/ <http://www.frameexpert.com/store/> 
--~----------------------------------------------------------------
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>