At 2010-05-10 16:08 -0700, Red Light wrote:
i have a a table with fixed column and sometime the text overload on
some adjancent column,
any one having a xsl template that insert a break space, periodicly?
, i mean i got a lot of tables and every time i have to accomodate
with a special column , i have found some static template in the
mailling list, but doesn't do the job for my use case (in fact i was
using breacking space from java and sending the data formated to my
xsl template http://pastebin.com/mUe4gPAW ) , but now ... i got to
do the work in the xsl side !
beside implementing my own routing!? is there any "automated/easy"
way ? (i'm using apache FOP by the way)
and thanks
An example I have from my classroom materials inserts a zero-width
space after URI punctuation characters so that long URIs wrap in
narrow columns without any visible spaces at the break points, where
the input URI is the current node:
replace(.,'([\[(.:/{\\])','$1​')
But in your situation you could do something like the following
(untested) for those text nodes that are descendants of the table construct:
<xsl:variable name="length" select="10"/>
<xsl:template match="table-thingy//text()" name="chop-it-up">
<xsl:param name="text" select="."/>
<xsl:choose>
<xsl:when test="string-length($text) <= $length">
<!--short enough-->
<xsl:value-of select="$text"/>
</xsl:when>
<xsl:otherwise>
<!--too long-->
<xsl:value-of select="substring( $text, 1, $length )"/>
<!--add a zero-width breaking space-->
<xsl:text>​</xsl:text>
<xsl:call-template name="chop-it-up">
<xsl:with-param name="text" select="substring($text,$length+1)"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
Note that when it is matched, the entire node is bound to $text, then
when it is called, only what hasn't been processed is bound to $text.
I hope this helps.
. . . . . . . . . . . . . Ken
--
XSLT/XQuery training: after http://XMLPrague.cz 2011-03-28/04-01
Vote for your XML training: http://www.CraneSoftwrights.com/s/i/
Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/
G. Ken Holman mailto:gkholman(_at_)CraneSoftwrights(_dot_)com
Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers: http://www.CraneSoftwrights.com/legal
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--