XSLT: Divide "long" words with spaces.
Posted
by kalininew
on Stack Overflow
See other posts from Stack Overflow
or by kalininew
Published on 2010-03-31T11:11:52Z
Indexed on
2010/03/31
11:13 UTC
Read the original article
Hit count: 507
There is a code:
<p>
Lorem ipsum dolor sit ametconsecteturadipisicing elit,
sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco
laboris nisi ut aliquip ex ea commodo consequat.
Duis aute iruredolorinreprehenderit in voluptate
velit esse cillum doloreeufugiatnullapariatur. Excepteur sint
occaecat cupidatat non proident, sunt in culpa qui officia
deserunt mollit anim id est laborum.
</p>
It is necessary to receive:
<p>
Lorem ipsum dolor sit <span class="spaced">a m e t c o n s e c t e t u r a d i p i s i c i n g</span> elit,
sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco
laboris nisi ut aliquip ex ea commodo consequat.
Duis aute <span class="spaced">i r u r e d o l o r i n r e p r e h e n d e r i t</span> in voluptate
velit esse cillum <span class="spaced">d o l o r e e u f u g i a t n u l l a p a r i a t u r</span>. Excepteur sint
occaecat cupidatat non proident, sunt in culpa qui officia
deserunt mollit anim id est laborum.
</p>
The sense consists in dividing "long" words with spaces. To put space after each letter in such word. Then it is necessary to conclude this word in a tag with a class "spaced".
The word is considered "long" if the quantity of letters in this word is more 10 (for example. It is possible to set any value).
How to solve this problem means xslt?
© Stack Overflow or respective owner