Re: [xep-support] Hyphenation at /

From: Jirka Kosek (
Date: Fri Apr 09 2004 - 05:05:14 PDT

  • Next message: Chen, Cindy (C)(STP): "[xep-support] Configuring of font sizes?"

    Nikolai Grigoriev wrote:

    > You are not supposed to do it manually: stylesheets or other preprocessors
    > should be able to cope with the task. Our initial assumption was that
    > a user can implement a line breaking algorighm of whatever complexity
    > by writing a separate preprocessor that would insert zero-width spaces
    > and soft hyphens to control the formatter. Now it seems that the interface
    > is too low-level, and requires too much effort to leverage.

    Just for the case that someone is intersted. I implemented exatly this
    yesterday. The following customization layer for DocBook XSL stylesheets
    allows line-breaking at /, \ and . (dot) when they are emitted as
    monospaced text by stylesheet (this includes e.g. filenames, classnames,
    function names and other similar markup).

    <?xml version="1.0" encoding="windows-1250"?>
    <xsl:stylesheet xmlns:xsl=""


    <xsl:template name="inline.monoseq">
       <xsl:param name="content">
       <fo:inline xsl:use-attribute-sets="">
         <xsl:if test="@dir">
           <xsl:attribute name="direction">
               <xsl:when test="@dir = 'ltr' or @dir = 'lro'">ltr</xsl:when>
         <xsl:apply-templates select="exsl:node-set($content)"

    <xsl:template match="text()" mode="hyphenatize" priority="2">
       <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="'.&#x200B;'"/>
             <xsl:with-param name="target" select="'\'"/>
             <xsl:with-param name="replacement" select="'\&#x200B;'"/>
         <xsl:with-param name="target" select="'/'"/>
         <xsl:with-param name="replacement" select="'/&#x200B;'"/>

    <xsl:template match="node()|@*" mode="hyphenatize">
         <xsl:apply-templates select="node()|@*" mode="hyphenatize"/>




       Jirka Kosek     e-mail:
       Profesionální školení a poradenství v oblasti technologií XML.
             XML a Java 13.-14.4.            XSL-FO 20.4.
             DocBook 18.-19.5.               XSLT 24.-26.5.

    (*) To unsubscribe, send a message with words 'unsubscribe xep-support'
    in the body of the message to from the address
    you are subscribed from.
    (*) By using the Service, you expressly agree to these Terms of Service

    This archive was generated by hypermail 2.1.5 : Fri Apr 09 2004 - 05:17:15 PDT