Link to home
Start Free TrialLog in
Avatar of mahalasa
mahalasa

asked on

xsl break word

i have 2 columns in a row.  Second column holds text. Text can be sentence or a single long word. IIf it is a single long word it tries to occupy first cell. I want the long word to break up and wrap.
please let me know if you have any suggestions.
Avatar of HainKurt
HainKurt
Flag of Canada image

wrap the second one in "a long text here bla bla bla...."
Avatar of mahalasa
mahalasa

ASKER

i dint get u..pls elaborat
Avatar of Gertone (Geert Bormans)
There is a multitude of options.
So I have a couple of questions for you:
- XSLT1 or XSLT2
- Which XSLT processor, can that change?
- How do you want to break, every n characters, is n a parameter, how do you intend to tell the size based on the cell width?
- HTML or PDF, or... have you considered CSS wrapping options such as word-wrap (IE only)
Is this XSL:FO?
basically pdf is generated. Yes i have tried word wrap no use.
yes xsl;block
any expert in xsl?
If it is xsl:fo, and it is long words and you processor can't deal with hyphenation correctly, then I assume that the best alternative you have is adding a zerowidth space between each letter
easily done in XSLT2, some recursion in XSLT1.
Would that work for you?
I assume you have tried the wrap options of FO
i have seen that 24 characters can fit in without issues. i need to wrap text to next line for word greater than 24 characters.
wrap option works only for sentence.
> any expert in xsl?

well, you have two here already?
Not enough?
Don't expect miracles if you ask half questions
how do we add zero width space?
:-)
wat would this zero width space do?
well, visually you would still have one word, so your FO processor will not show the character.
For the processor however the word is no longer a word, but a sequence of characters with spaces in between, so wrapping will work as you please
This seems like resolving my issue. can you give me an example to use it with code snippet.

Thank a lot :-)
Depending on FO processor, have you tried placing the text within each cell within a block, then use the 'wrap-option" attribute set to "wrap"?
yes, its already within a block :-(
Which processor have you used?
Are you sure you have exposed the wrap options in the block?
i am not sure abt the processor :-( i am new to xsl . yes i have tried wrap option. my pdf work absolutely fine for long sentence with proper wrapping
can u give me a code snippet which uses zero width spacing
there are two processors, one for XSLT and one for XSL:FO
It makes sense that you know both of the processor brands and possibilities
Processors have specific implementations, so it can bite you if you don't have a clue

I will assume you have XSLT1 for the zero width stuff
Hi Gertone, i need one more help
do u know abt itext?
any code snippet using it would be really helpful
ASKER CERTIFIED SOLUTION
Avatar of Gertone (Geert Bormans)
Gertone (Geert Bormans)
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Great response. I am really thankful.