IMPORTANT:
this is not a Support Forum! Experienced users might answer from time to time questions posted here. If you need a professional and reliable answer, or if you want to report a bug, please contact Altova Support instead.

Split 180 characters into 4 attributes with max 60 characters per attribut Options · View
Marcus.T
Posted: Thursday, May 19, 2016 2:43:14 PM
Rank: Member

Joined: 1/28/2015
Posts: 23
Location: Sweden
Hello
I have a problem in xslt2 where I try to split a text that is 180 characters long into four attributes where each maximum length must be 60 characters.
I want to make the split where the last space itself is before 60 characters.

Example:
Text before the split :

The earliest known appearance of the phrase is from the Michigan School Moderator , a journal That provided many teachers with education- related news and suggestions for lessons.

The text after the split :
Attribut1
The earliest known appearance of the phrase is from the

Attribut2
Michigan School Moderator , a journal That provided many

Attribut3
teachers with education- related news and suggestions for

Attribut4
lessons.


I just cant figure it out...
vlad
Posted: Thursday, May 19, 2016 3:18:31 PM
Rank: Advanced Member

Joined: 12/13/2005
Posts: 2,856
Location: Mauritius
Did you try to use the function tokenize-by-length?
Marcus.T
Posted: Thursday, May 19, 2016 7:05:10 PM
Rank: Member

Joined: 1/28/2015
Posts: 23
Location: Sweden
vlad wrote:
Did you try to use the function tokenize-by-length?


Hmm, can you please explain how?
Marcus.T
Posted: Friday, May 20, 2016 10:05:48 AM
Rank: Member

Joined: 1/28/2015
Posts: 23
Location: Sweden
Anyone? Please...

Is there any smart way of using regular expression on this one?
Have tried to find something in the "help" file, but could not get it right...



Ok i solved it. Maybe not the prettiest solution, but it works...
Edit, new pic... this one works!
K101
Posted: Monday, November 19, 2018 12:41:27 PM
Rank: Advanced Member

Joined: 2/27/2009
Posts: 441
Attached are actual example files which demonstrate how to do this using a recursive User-Defined Function (UDF).

File Attachment(s):
example.zip (4kb) downloaded 189 time(s).


Users browsing this topic
guest

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Use of the Altova User Forum(s) is governed by the Altova Terms of Use.