Re: Simple Word Wrap?
I have a somewhat unique problem. I'm converting legal xml documents into pdfs and I've run into a big of a snag.
Actually, this shows up with long URI strings quite often. I have it in many of my production XSL-FO stylesheets.
In one particular document, I'm dealing with drugs. So I have "words" that look like "N-(3-methyl-1-(2-phenylethyl)-4-piperidly)-N-phenylpropanamide". Since the block area I'm working in needs to be justified text, you might see where "words" of that length cause many aesthetic issues within the pdf. I've tried to go in manually and enter spaces where I felt a word wrap should take place. However, due to the nature of how justification is handled is xsl, this doesn't seem to be a viable option as I'm still left with rather large gaps between words.
By injecting a zero-width space (​) where you want to allow a line break to happen. If no line break is needed, there is no visual disturbance. If a line break is needed, the line breaks at the space.
For example, you could have the following in XSLT 2.0:
... which injects a zero-width space before each left parenthesis and after each right-parenthesis.
In URI strings I inject them after each slash.
The presentation treats the character as a space, but the character doesn't take any room on the line, thus presenting a string as if it were unbroken.
I hope this helps.
. . . . . . . . . . . . Ken
-- Upcoming public training: UBL and code lists Oct 1/5; Madrid Spain World-wide corporate, govt. & user group XML, XSL and UBL training RSS feeds: publicly-available developer resources and training G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995) Male Cancer Awareness Jul'07 http://www.CraneSoftwrights.com/s/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format