Hi,

I have requirement to split a line into multiple lines based on length, however, breaking on word boundaries. This means if the last word on a given line doesn't fit into the current line it spills over to the next line. Also if a word is longer than the line-length, it will get split based on the line length. Is there anyway to do this using just XPath 2.0 functions and not using recursive calls?

Input

<test>
    one flew over the cuckoo's nest the godfather the shining once upon a time in america the goodfellas scarface.
</test>

Output where the line length is 35

01234567890123456789012345678901234

one flew over the cuckoo's nest the

 godfather the shining once upon a
time in america the goodfellas
scarface.

Thanks
Meeraj