Hi everybody,
I have succeeded in producing a chinese PDF from an XML document via a
XSL transformation.
There is a last problem. The professional chinese document should not
let a chinese character alone on a line.
For instance, I have the sentense "AZERTYUIO." to render in PDF. XEP
generate a PDF with :
AZERTYUI
O.
And, for chinese people, that's not a well rendered document. The
prefered layout is :
AZERTYUIO. (the characters have to be compressed)
or
AZERTYU (the characters have to be expanded)
IO.
The only way I found to do so is to force the last three characters of a
text to be "no-wrap". Here is my XSL template :
<xsl:template match="text()">
<xsl:variable name="txt">
<xsl:call-template name="string.subst">
<xsl:with-param name="string">
<xsl:call-template name="string.subst">
<xsl:with-param name="string">
<xsl:call-template name="string.subst">
<xsl:with-param name="string" select="." />
<xsl:with-param name="target"
select="'.'" />
<xsl:with-param name="replacement"
select="'.​'" />
</xsl:call-template>
</xsl:with-param>
<xsl:with-param name="target" select="'\'" />
<xsl:with-param name="replacement"
select="'\​'" />
</xsl:call-template>
</xsl:with-param>
<xsl:with-param name="target" select="'/'" />
<xsl:with-param name="replacement" select="'/​'" />
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<xsl:when test="string-length($txt) > 3">
<xsl:value-of select="substring($txt, 1,
string-length($txt)-3)" />
<fo:inline wrap-option="no-wrap" hyphenate="false"
keep-together.within-line="always">
<xsl:value-of select="substring($txt,
string-length($txt)-2, string-length($txt))" />
</fo:inline>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$txt" />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
And that's a not good solution because some ends of line can be missed.
In my XML source document, I can have inline formatting properties, like
bold or italic, that makes the text sequence shorter than 3, even if the
complete sentense contains more than 3 characters.
Is there any other way to handle this hyphenation particularity ?
Thanks in advance
Nicolas
-- Nicolas LALEVÉE Solutions & Technologies ANYWARE TECHNOLOGIES Tel : +33 (0)5 61 00 52 90 Fax : +33 (0)5 61 00 51 46 http://www.anyware-tech.com ------------------- (*) To unsubscribe, send a message with words 'unsubscribe xep-support' in the body of the message to majordomo@renderx.com from the address you are subscribed from. (*) By using the Service, you expressly agree to these Terms of Service http://www.renderx.com/terms-of-service.htmlReceived on Mon Mar 6 01:51:58 2006
This archive was generated by hypermail 2.1.8 : Mon Mar 06 2006 - 01:52:00 PST