« Return to Thread: keep-together.within-column

Re: AW: AW: keep-together.within-column

by sandraB :: Rate this Message:

Reply to Author | View in Thread

Hi,
I'm facing another issue. I keep my solution but with yours it will be the same problem:
I transform the text() node by replacing the '.' with '\u200B'. But how can I call the <xsl:apply-templates> on the result (I can have some bold text text or italic text text in a table cell) ?

My templates

<xsl:template match="td">
          <fo:table-cell overflow="visible" keep-together.within-column="always">
            <fo:block padding="0cm" white-space-collapse="false">
            <xsl:call-template name="addZeroWidthSpace" >
                                <xsl:with-param name="str" select="text()" />
                        </xsl:call-template>
            </fo:block>
           </fo:table-cell>
</xsl:template>
<xsl:template name="addZeroWidthSpace">
                <xsl:param name="str" />
                <xsl:variable name="hyphenation-character">​</xsl:variable>
                <xsl:choose>
                        <xsl:when test="'.' and contains($str, '.')">
                               <!-- I need to apply another templates on substring-before($str, '.')  -->
                                <xsl:value-of select="substring-before($str, '.')" />.<xsl:value-of select="$hyphenation-character" />
                                <xsl:call-template name="addZeroWidthSpace">
            <xsl:with-param name="str" select="substring-after($str, '.')" />
                                </xsl:call-template>
                        </xsl:when>
                        <xsl:otherwise>
                               <!-- I need to apply another templates here -->
                                <xsl:value-of select="$str" />
                        </xsl:otherwise>
                </xsl:choose>
        </xsl:template>


Vincent Hennebert-2 wrote:
Hi Sandra,

sandraB wrote:
> I'm using a xsl stylesheet to transform an xml file to FO file. I don't know
> exactly in which cells I can get the classnames.

So that means that you don’t have a special markup for classnames? In
which case it’s only a guess game indeed. Maybe you can use a regexp
attempting at identifying classnames; something like
[a-zA-Z]+\(\.[a-zA-Z]+\)*
As to implement that in XSLT...


> I use a template to search
> '.' and replace it by '\u200B' but I'm facing another problem with the
> invalid character (\). I'll update this topic when I will have the solution,
> but feel free to comment my solution.

You can use the XML entity: ​
Just put it like this in your XSLT stylesheet, and the XSLT processor
should process it correctly.


> Georg Datterl wrote:
>> Hi Sandra,
>>
>> Basically depends how you get your data and where you manipulate it. I
>> think, in the end the class name should look like
>> com.\u200Bxxxxxxxxxxxxx.\u200Bxxxxxxx.\u200Bxxxxxxx.\u200Bxxxxxxxxx.\u200BGenericDecoder
>> (in case Outlook is killing that: after each period is a unicode 200B).
>> That should do the trick. Possibly more elegant readers can provide more
>> elegant solutions.

HTH,
Vincent

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org

 « Return to Thread: keep-together.within-column