Loading ...
Sorry, an error occurred while loading the content.

forcing line breaks

Expand Messages
  • Jim
    Greetings, I m trying to force a table column to wrap, and the text (a proper name) potentially has no whitespace available for a nice line break. Is there an
    Message 1 of 19 , Dec 3, 2001
    • 0 Attachment
      Greetings, I'm trying to force a table column to wrap, and the text
      (a proper name) potentially has no whitespace available for a nice
      line break. Is there an attribute I can set to force a line break at
      the end of the table column? The "hyphenate" and "hyphenate-keep"
      attributes don't seem to do what I need...

      Thank you in advance,
      Jim
    • shweenus@yahoo.com
      Not really sure if I understand you. You can try setting this attribute in your block object: linefeed-treatment= preserve It will keep line breaks that are
      Message 2 of 19 , Dec 4, 2001
      • 0 Attachment
        Not really sure if I understand you. You can try setting this
        attribute in your block object: linefeed-treatment="preserve" It will
        keep line breaks that are inside your block.

        --- In XSL-FO@y..., "Jim" <blackbox@b...> wrote:
        >
        > Greetings, I'm trying to force a table column to wrap, and the text
        > (a proper name) potentially has no whitespace available for a nice
        > line break. Is there an attribute I can set to force a line break
        at
        > the end of the table column? The "hyphenate" and "hyphenate-keep"
        > attributes don't seem to do what I need...
        >
        > Thank you in advance,
        > Jim
      • Jim
        Okay, I ve posted a file called SCR1268.bmp in the Files section. This illustrates the problem I m having, and hopefully FO has a simple attribute or
        Message 3 of 19 , Dec 4, 2001
        • 0 Attachment
          Okay, I've posted a file called "SCR1268.bmp" in the Files section.
          This illustrates the problem I'm having, and hopefully FO has a
          simple attribute or something I can set to fix it.

          Thanks again,
          Jim

          --- In XSL-FO@y..., shweenus@y... wrote:
          > Not really sure if I understand you. You can try setting this
          > attribute in your block object: linefeed-treatment="preserve" It
          will
          > keep line breaks that are inside your block.
          >
          > --- In XSL-FO@y..., "Jim" <blackbox@b...> wrote:
          > >
          > > Greetings, I'm trying to force a table column to wrap, and the
          text
          > > (a proper name) potentially has no whitespace available for a
          nice
          > > line break. Is there an attribute I can set to force a line break
          > at
          > > the end of the table column? The "hyphenate" and "hyphenate-keep"
          > > attributes don't seem to do what I need...
          > >
          > > Thank you in advance,
          > > Jim
        • shweenus
          okay try this block attribute: wrap-option= wrap ... break ... keep
          Message 4 of 19 , Dec 5, 2001
          • 0 Attachment
            okay try this block attribute: wrap-option="wrap"

            --- In XSL-FO@y..., "Jim" <blackbox@b...> wrote:
            > Okay, I've posted a file called "SCR1268.bmp" in the Files section.
            > This illustrates the problem I'm having, and hopefully FO has a
            > simple attribute or something I can set to fix it.
            >
            > Thanks again,
            > Jim
            >
            > --- In XSL-FO@y..., shweenus@y... wrote:
            > > Not really sure if I understand you. You can try setting this
            > > attribute in your block object: linefeed-treatment="preserve" It
            > will
            > > keep line breaks that are inside your block.
            > >
            > > --- In XSL-FO@y..., "Jim" <blackbox@b...> wrote:
            > > >
            > > > Greetings, I'm trying to force a table column to wrap, and the
            > text
            > > > (a proper name) potentially has no whitespace available for a
            > nice
            > > > line break. Is there an attribute I can set to force a line
            break
            > > at
            > > > the end of the table column? The "hyphenate" and "hyphenate-
            keep"
            > > > attributes don't seem to do what I need...
            > > >
            > > > Thank you in advance,
            > > > Jim
          • barrett808
            This doesn t seem to work, alas. Here s the relevant code snippet:
            Message 5 of 19 , Dec 5, 2001
            • 0 Attachment
              This doesn't seem to work, alas. Here's the relevant code snippet:

              <fo:table-body border-style="solid" border-width="thin">
              <xsl:for-each select="qtar:Patient">
              <fo:table-row>
              <fo:table-cell text-align="left" border-style="solid" border-
              width="thin" padding-before="1pt" padding-after="1pt" padding-
              start="1pt" padding-end="1pt">
              <fo:block wrap-option="wrap">
              <xsl:value-of select="@DisplayName"/>
              </fo:block>
              </fo:table-cell>

              ...

              I've also tried adding this attribute to enclosiong (parent) block
              elements, with no luck.

              Jim

              --- In XSL-FO@y..., "shweenus" <shweenus@y...> wrote:
              > okay try this block attribute: wrap-option="wrap"
              >
              > --- In XSL-FO@y..., "Jim" <blackbox@b...> wrote:
              > > Okay, I've posted a file called "SCR1268.bmp" in the Files
              section.
              > > This illustrates the problem I'm having, and hopefully FO has a
              > > simple attribute or something I can set to fix it.
              > >
              > > Thanks again,
              > > Jim
              > >
              > > --- In XSL-FO@y..., shweenus@y... wrote:
              > > > Not really sure if I understand you. You can try setting this
              > > > attribute in your block object: linefeed-treatment="preserve"
              It
              > > will
              > > > keep line breaks that are inside your block.
              > > >
              > > > --- In XSL-FO@y..., "Jim" <blackbox@b...> wrote:
              > > > >
              > > > > Greetings, I'm trying to force a table column to wrap, and
              the
              > > text
              > > > > (a proper name) potentially has no whitespace available for a
              > > nice
              > > > > line break. Is there an attribute I can set to force a line
              > break
              > > > at
              > > > > the end of the table column? The "hyphenate" and "hyphenate-
              > keep"
              > > > > attributes don't seem to do what I need...
              > > > >
              > > > > Thank you in advance,
              > > > > Jim
            • dvd@renderx.com
              ... Attributes are of no use here. In XEP, you may add zero-width spaces wherever you want thus allowing line breaks. Just intersperse letters with zero-width
              Message 6 of 19 , Dec 5, 2001
              • 0 Attachment
                > This doesn't seem to work, alas. Here's the relevant code snippet:
                >
                > <fo:table-body border-style="solid" border-width="thin">
                > <xsl:for-each select="qtar:Patient">
                > <fo:table-row>
                > <fo:table-cell text-align="left" border-style="solid" border-
                > width="thin" padding-before="1pt" padding-after="1pt" padding-
                > start="1pt" padding-end="1pt">
                > <fo:block wrap-option="wrap">
                > <xsl:value-of select="@DisplayName"/>
                > </fo:block>
                > </fo:table-cell>
                >
                > ...
                >
                > I've also tried adding this attribute to enclosiong (parent) block
                > elements, with no luck.
                >

                Attributes are of no use here. In XEP, you may add zero-width spaces
                wherever you want thus allowing line breaks. Just intersperse letters
                with zero-width spaces in all words inside table sells and the text
                will break right at the cells' edges.

                Sincerely,
                David Tolpin
                RenderX
              • barrett808
                Thank you for the good tip, David. It s too late in our dev cycle to consider using a different renderer, and I m getting the impression that there s no native
                Message 7 of 19 , Dec 5, 2001
                • 0 Attachment
                  Thank you for the good tip, David. It's too late in our dev cycle to
                  consider using a different renderer, and I'm getting the impression
                  that there's no native FO solution.

                  Anybody have other ideas? Or am I just up the creek w/o a paddle?


                  --- In XSL-FO@y..., dvd@r... wrote:
                  > Attributes are of no use here. In XEP, you may add zero-width spaces
                  > wherever you want thus allowing line breaks. Just intersperse
                  letters
                  > with zero-width spaces in all words inside table sells and the text
                  > will break right at the cells' edges.
                  >
                  > Sincerely,
                  > David Tolpin
                  > RenderX
                • David Cramer
                  David, Could you give an example of this technique? What s a zero-width space and how do you intersperse them between letters in a given text node with xsl?
                  Message 8 of 19 , Dec 5, 2001
                  • 0 Attachment
                    David,
                    Could you give an example of this technique? What's a zero-width space
                    and how do you intersperse them between letters in a given text node
                    with xsl?

                    Thanks,
                    David

                    -----Original Message-----
                    From: dvd@... [mailto:dvd@...]
                    Sent: Wednesday, December 05, 2001 4:47 PM
                    To: xsl-fo@yahoogroups.com
                    Subject: Re: [XSL-FO] Re: forcing line breaks

                    <snip>

                    Attributes are of no use here. In XEP, you may add zero-width spaces
                    wherever you want thus allowing line breaks. Just intersperse letters
                    with zero-width spaces in all words inside table sells and the text
                    will break right at the cells' edges.

                    Sincerely,
                    David Tolpin
                    RenderX
                  • dvd@renderx.com
                    ... Zero-width space IS a native FO solution. Zero-width space is a Unicode character. An FO formatter is expected to be able to break lines on zero-width
                    Message 9 of 19 , Dec 5, 2001
                    • 0 Attachment
                      >
                      >
                      > Thank you for the good tip, David. It's too late in our dev cycle to
                      > consider using a different renderer, and I'm getting the impression
                      > that there's no native FO solution.
                      >
                      > Anybody have other ideas? Or am I just up the creek w/o a paddle?

                      Zero-width space IS a native FO solution. Zero-width space is a Unicode
                      character. An FO formatter is expected to be able to break lines on
                      zero-width spaces.

                      It is a deficiency of a formatter not to handle zero-width spaces
                      properly.

                      David Tolpin
                      RenderX
                    • barrett808
                      Well, that just shows you how little I know about XSL...Is there some convenient way to transform a text element to one with zero-width spaces interspersed?
                      Message 10 of 19 , Dec 5, 2001
                      • 0 Attachment
                        Well, that just shows you how little I know about XSL...Is there some
                        convenient way to transform a text element to one with zero-width
                        spaces interspersed? Seems that would be a nifty transformation to
                        have in our toolkit.


                        --- In XSL-FO@y..., dvd@r... wrote:
                        > >
                        > >
                        > > Thank you for the good tip, David. It's too late in our dev cycle
                        to
                        > > consider using a different renderer, and I'm getting the
                        impression
                        > > that there's no native FO solution.
                        > >
                        > > Anybody have other ideas? Or am I just up the creek w/o a paddle?
                        >
                        > Zero-width space IS a native FO solution. Zero-width space is a
                        Unicode
                        > character. An FO formatter is expected to be able to break lines on
                        > zero-width spaces.
                        >
                        > It is a deficiency of a formatter not to handle zero-width spaces
                        > properly.
                        >
                        > David Tolpin
                        > RenderX
                      • Nikolai Grigoriev
                        Hi, ...
                        Message 11 of 19 , Dec 6, 2001
                        • 0 Attachment
                          Hi,

                          > Well, that just shows you how little I know about XSL...Is there some
                          > convenient way to transform a text element to one with zero-width
                          > spaces interspersed? Seems that would be a nifty transformation to
                          > have in our toolkit.

                          <xsl:template match="text()" mode="insert-zero-spaces">
                          <xsl:call-template name="intersperse-with-zero-spaces">
                          <xsl:with-param name="str" select="."/>
                          </xsl:call-template>
                          </xsl:template>

                          <xsl:template name="intersperse-with-zero-spaces">
                          <xsl:param name="str"/>
                          <xsl:variable name="spacechars">

                                
                               ​
                          </xsl:variable>

                          <xsl:if test="string-length($str) > 1">
                          <xsl:variable name="c1" select="substring($str, 1, 1)/>
                          <xsl:variable name="c2" select="substring($str, 2, 1)/>

                          <xsl:value-of select="$c1"/>
                          <!-- Insert a zero-width space between any two non-space characters -->
                          <xsl:if test="not(contains($spacechars, $c1) or contains($spacechars,
                          $c2))">
                          <xsl:text>​</xsl:text>
                          </xsl:if>

                          <xsl:call-template name="intersperse-with-zero-spaces">
                          <xsl:with-param name="str" select="substring($str, 2)"/>
                          </xsl:call-template>
                          </xsl:if>
                          </xsl:call-template>

                          Regards,

                          Nikolai Grigoriev
                          RenderX
                        • barrett808
                          Thank you, Nikolai. This looks promising, but I m having problems making it work. Here s the code (slightly adapted) I m using, and it basically just spits out
                          Message 12 of 19 , Dec 6, 2001
                          • 0 Attachment
                            Thank you, Nikolai. This looks promising, but I'm having problems
                            making it work. Here's the code (slightly adapted) I'm using, and it
                            basically just spits out the text content of the elements with a
                            bunch of white space between them.

                            <?xml version="1.0" encoding="UTF-16"?>
                            <xsl:stylesheet version="1.0"
                            xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                            xmlns:fo="http://www.w3.org/1999/XSL/Format">
                            <!-- This template sprinkles zero-width space characters in a
                            text element -->
                            <xsl:template match="text()" mode="insert-zero-spaces">
                            <xsl:call-template name="intersperse-with-zero-
                            spaces">
                            <xsl:with-param name="str" select="."/>
                            </xsl:call-template>
                            </xsl:template>
                            <xsl:template name="intersperse-with-zero-spaces">
                            <xsl:param name="str"/>
                            <xsl:variable name="spacechars">

                                  
                                 ​
                            </xsl:variable>
                            <xsl:if test="string-length($str) > 1">
                            <xsl:variable name="c1" select="substring
                            ($str, 1, 1)"/>
                            <xsl:variable name="c2" select="substring
                            ($str, 2, 1)"/>
                            <xsl:value-of select="$c1"/>
                            <!-- Insert a zero-width space between any
                            two non-space characters -->
                            <!-- <xsl:if test="not(contains($spacechars,
                            $c1) or contains($spacechars,
                            $c2))"> -->
                            <!-- <xsl:text>​</xsl:text> -->
                            <xsl:text>F</xsl:text>
                            <!-- </xsl:if> -->
                            <xsl:call-template name="intersperse-with-
                            zero-spaces">
                            <xsl:with-param name="str"
                            select="substring($str, 2)"/>
                            </xsl:call-template>
                            </xsl:if>
                            </xsl:template>
                            </xsl:stylesheet>


                            --- In XSL-FO@y..., "Nikolai Grigoriev" <grig@r...> wrote:
                            > Hi,
                            >
                            > > Well, that just shows you how little I know about XSL...Is there
                            some
                            > > convenient way to transform a text element to one with zero-width
                            > > spaces interspersed? Seems that would be a nifty transformation to
                            > > have in our toolkit.
                            >
                            > <xsl:template match="text()" mode="insert-zero-spaces">
                            > <xsl:call-template name="intersperse-with-zero-spaces">
                            > <xsl:with-param name="str" select="."/>
                            > </xsl:call-template>
                            > </xsl:template>
                            >
                            > <xsl:template name="intersperse-with-zero-spaces">
                            > <xsl:param name="str"/>
                            > <xsl:variable name="spacechars">
                            >
                            >       
                            >      ​
                            > </xsl:variable>
                            >
                            > <xsl:if test="string-length($str) > 1">
                            > <xsl:variable name="c1" select="substring($str, 1, 1)/>
                            > <xsl:variable name="c2" select="substring($str, 2, 1)/>
                            >
                            > <xsl:value-of select="$c1"/>
                            > <!-- Insert a zero-width space between any two non-space
                            characters -->
                            > <xsl:if test="not(contains($spacechars, $c1) or contains
                            ($spacechars,
                            > $c2))">
                            > <xsl:text>​</xsl:text>
                            > </xsl:if>
                            >
                            > <xsl:call-template name="intersperse-with-zero-spaces">
                            > <xsl:with-param name="str" select="substring($str, 2)"/>
                            > </xsl:call-template>
                            > </xsl:if>
                            > </xsl:call-template>
                            >
                            > Regards,
                            >
                            > Nikolai Grigoriev
                            > RenderX
                          • barrett808
                            er, here s the actual code (minus spuriously commented out lines):
                            Message 13 of 19 , Dec 6, 2001
                            • 0 Attachment
                              er, here's the actual code (minus spuriously commented out lines):

                              <?xml version="1.0" encoding="UTF-16"?>
                              <xsl:stylesheet version="1.0"
                              xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                              xmlns:fo="http://www.w3.org/1999/XSL/Format">
                              <!-- This template sprinkles zero-width space characters in a
                              text element -->
                              <xsl:template match="text()" mode="insert-zero-spaces">
                              <xsl:call-template name="intersperse-with-zero-
                              spaces">
                              <xsl:with-param name="str" select="."/>
                              </xsl:call-template>
                              </xsl:template>
                              <xsl:template name="intersperse-with-zero-spaces">
                              <xsl:param name="str"/>
                              <xsl:variable name="spacechars">

                                    
                                   ​
                              </xsl:variable>
                              <xsl:if test="string-length($str) > 1">
                              <xsl:variable name="c1" select="substring
                              ($str, 1, 1)"/>
                              <xsl:variable name="c2" select="substring
                              ($str, 2, 1)"/>
                              <xsl:value-of select="$c1"/>
                              <!-- Insert a zero-width space between any
                              two non-space characters -->
                              <xsl:if test="not(contains($spacechars, $c1)
                              or contains($spacechars,
                              $c2))">
                              <xsl:text>​</xsl:text>
                              <xsl:text>F</xsl:text>
                              </xsl:if>
                              <xsl:call-template name="intersperse-with-
                              zero-spaces">
                              <xsl:with-param name="str"
                              select="substring($str, 2)"/>
                              </xsl:call-template>
                              </xsl:if>
                              </xsl:template>
                              </xsl:stylesheet>
                            • barrett808
                              Ah, progress: taking out the mode= insert-zero-spaces attribute from the first template gets me strings with embedded nonprintable characters, which is a lot
                              Message 14 of 19 , Dec 6, 2001
                              • 0 Attachment
                                Ah, progress: taking out the mode="insert-zero-spaces" attribute from
                                the first template gets me strings with embedded nonprintable
                                characters, which is a lot closer. More to follow...

                                --- In XSL-FO@y..., "barrett808" <blackbox@b...> wrote:
                                > Thank you, Nikolai. This looks promising, but I'm having problems
                                > making it work. Here's the code (slightly adapted) I'm using, and
                                it
                                > basically just spits out the text content of the elements with a
                                > bunch of white space between them.
                                >
                                > <?xml version="1.0" encoding="UTF-16"?>
                                > <xsl:stylesheet version="1.0"
                                > xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                                > xmlns:fo="http://www.w3.org/1999/XSL/Format">
                                > <!-- This template sprinkles zero-width space characters in a
                                > text element -->
                                > <xsl:template match="text()" mode="insert-zero-spaces">
                                > <xsl:call-template name="intersperse-with-zero-
                                > spaces">
                                > <xsl:with-param name="str" select="."/>
                                > </xsl:call-template>
                                > </xsl:template>
                                > <xsl:template name="intersperse-with-zero-spaces">
                                > <xsl:param name="str"/>
                                > <xsl:variable name="spacechars">
                                >
                                >       
                                >      ​
                                > </xsl:variable>
                                > <xsl:if test="string-length($str) > 1">
                                > <xsl:variable name="c1" select="substring
                                > ($str, 1, 1)"/>
                                > <xsl:variable name="c2" select="substring
                                > ($str, 2, 1)"/>
                                > <xsl:value-of select="$c1"/>
                                > <!-- Insert a zero-width space between any
                                > two non-space characters -->
                                > <!-- <xsl:if test="not(contains($spacechars,
                                > $c1) or contains($spacechars,
                                > $c2))"> -->
                                > <!-- <xsl:text>​</xsl:text> -->
                                > <xsl:text>F</xsl:text>
                                > <!-- </xsl:if> -->
                                > <xsl:call-template name="intersperse-with-
                                > zero-spaces">
                                > <xsl:with-param name="str"
                                > select="substring($str, 2)"/>
                                > </xsl:call-template>
                                > </xsl:if>
                                > </xsl:template>
                                > </xsl:stylesheet>
                                >
                                >
                                > --- In XSL-FO@y..., "Nikolai Grigoriev" <grig@r...> wrote:
                                > > Hi,
                                > >
                                > > > Well, that just shows you how little I know about XSL...Is
                                there
                                > some
                                > > > convenient way to transform a text element to one with zero-
                                width
                                > > > spaces interspersed? Seems that would be a nifty transformation
                                to
                                > > > have in our toolkit.
                                > >
                                > > <xsl:template match="text()" mode="insert-zero-spaces">
                                > > <xsl:call-template name="intersperse-with-zero-spaces">
                                > > <xsl:with-param name="str" select="."/>
                                > > </xsl:call-template>
                                > > </xsl:template>
                                > >
                                > > <xsl:template name="intersperse-with-zero-spaces">
                                > > <xsl:param name="str"/>
                                > > <xsl:variable name="spacechars">
                                > >
                                > >       
                                > >      ​
                                > > </xsl:variable>
                                > >
                                > > <xsl:if test="string-length($str) > 1">
                                > > <xsl:variable name="c1" select="substring($str, 1, 1)/>
                                > > <xsl:variable name="c2" select="substring($str, 2, 1)/>
                                > >
                                > > <xsl:value-of select="$c1"/>
                                > > <!-- Insert a zero-width space between any two non-space
                                > characters -->
                                > > <xsl:if test="not(contains($spacechars, $c1) or contains
                                > ($spacechars,
                                > > $c2))">
                                > > <xsl:text>​</xsl:text>
                                > > </xsl:if>
                                > >
                                > > <xsl:call-template name="intersperse-with-zero-spaces">
                                > > <xsl:with-param name="str" select="substring($str,
                                2)"/>
                                > > </xsl:call-template>
                                > > </xsl:if>
                                > > </xsl:call-template>
                                > >
                                > > Regards,
                                > >
                                > > Nikolai Grigoriev
                                > > RenderX
                              • barrett808
                                Okay, finally got it work exactly as I want it to, thanks Nikolai! Unfortunately, my FO renderer (XSL Formatter by Antenna House) doesn t seem to like these
                                Message 15 of 19 , Dec 6, 2001
                                • 0 Attachment
                                  Okay, finally got it work exactly as I want it to, thanks Nikolai!
                                  Unfortunately, my FO renderer (XSL Formatter by Antenna House)
                                  doesn't seem to like these zero-width spaces. My name strings come
                                  out as "L? a? s? t? N? a? m? e"

                                  D'oh.


                                  --- In XSL-FO@y..., "barrett808" <blackbox@b...> wrote:
                                  > Ah, progress: taking out the mode="insert-zero-spaces" attribute
                                  from
                                  > the first template gets me strings with embedded nonprintable
                                  > characters, which is a lot closer. More to follow...
                                  >
                                  > --- In XSL-FO@y..., "barrett808" <blackbox@b...> wrote:
                                  > > Thank you, Nikolai. This looks promising, but I'm having problems
                                  > > making it work. Here's the code (slightly adapted) I'm using, and
                                  > it
                                  > > basically just spits out the text content of the elements with a
                                  > > bunch of white space between them.
                                  > >
                                  > > <?xml version="1.0" encoding="UTF-16"?>
                                  > > <xsl:stylesheet version="1.0"
                                  > > xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                                  > > xmlns:fo="http://www.w3.org/1999/XSL/Format">
                                  > > <!-- This template sprinkles zero-width space characters in a
                                  > > text element -->
                                  > > <xsl:template match="text()" mode="insert-zero-spaces">
                                  > > <xsl:call-template name="intersperse-with-zero-
                                  > > spaces">
                                  > > <xsl:with-param name="str" select="."/>
                                  > > </xsl:call-template>
                                  > > </xsl:template>
                                  > > <xsl:template name="intersperse-with-zero-spaces">
                                  > > <xsl:param name="str"/>
                                  > > <xsl:variable name="spacechars">
                                  > >
                                  > >       
                                  > >      ​
                                  > > </xsl:variable>
                                  > > <xsl:if test="string-length($str) > 1">
                                  > > <xsl:variable name="c1" select="substring
                                  > > ($str, 1, 1)"/>
                                  > > <xsl:variable name="c2" select="substring
                                  > > ($str, 2, 1)"/>
                                  > > <xsl:value-of select="$c1"/>
                                  > > <!-- Insert a zero-width space between any
                                  > > two non-space characters -->
                                  > > <!-- <xsl:if test="not(contains($spacechars,
                                  > > $c1) or contains($spacechars,
                                  > > $c2))"> -->
                                  > > <!-- <xsl:text>​</xsl:text> -->
                                  > > <xsl:text>F</xsl:text>
                                  > > <!-- </xsl:if> -->
                                  > > <xsl:call-template name="intersperse-with-
                                  > > zero-spaces">
                                  > > <xsl:with-param name="str"
                                  > > select="substring($str, 2)"/>
                                  > > </xsl:call-template>
                                  > > </xsl:if>
                                  > > </xsl:template>
                                  > > </xsl:stylesheet>
                                  > >
                                  > >
                                  > > --- In XSL-FO@y..., "Nikolai Grigoriev" <grig@r...> wrote:
                                  > > > Hi,
                                  > > >
                                  > > > > Well, that just shows you how little I know about XSL...Is
                                  > there
                                  > > some
                                  > > > > convenient way to transform a text element to one with zero-
                                  > width
                                  > > > > spaces interspersed? Seems that would be a nifty
                                  transformation
                                  > to
                                  > > > > have in our toolkit.
                                  > > >
                                  > > > <xsl:template match="text()" mode="insert-zero-spaces">
                                  > > > <xsl:call-template name="intersperse-with-zero-spaces">
                                  > > > <xsl:with-param name="str" select="."/>
                                  > > > </xsl:call-template>
                                  > > > </xsl:template>
                                  > > >
                                  > > > <xsl:template name="intersperse-with-zero-spaces">
                                  > > > <xsl:param name="str"/>
                                  > > > <xsl:variable name="spacechars">
                                  > > >
                                  > > >       
                                  > > >      ​
                                  > > > </xsl:variable>
                                  > > >
                                  > > > <xsl:if test="string-length($str) > 1">
                                  > > > <xsl:variable name="c1" select="substring($str, 1, 1)/>
                                  > > > <xsl:variable name="c2" select="substring($str, 2, 1)/>
                                  > > >
                                  > > > <xsl:value-of select="$c1"/>
                                  > > > <!-- Insert a zero-width space between any two non-
                                  space
                                  > > characters -->
                                  > > > <xsl:if test="not(contains($spacechars, $c1) or
                                  contains
                                  > > ($spacechars,
                                  > > > $c2))">
                                  > > > <xsl:text>​</xsl:text>
                                  > > > </xsl:if>
                                  > > >
                                  > > > <xsl:call-template name="intersperse-with-zero-spaces">
                                  > > > <xsl:with-param name="str" select="substring($str,
                                  > 2)"/>
                                  > > > </xsl:call-template>
                                  > > > </xsl:if>
                                  > > > </xsl:call-template>
                                  > > >
                                  > > > Regards,
                                  > > >
                                  > > > Nikolai Grigoriev
                                  > > > RenderX
                                • Nikolai Grigoriev
                                  ... Hmm. For me, it worked in Saxon, XT, and Xalan after correcting several evident misprints. Below is the full text of my testing stylesheet. My guess: you
                                  Message 16 of 19 , Dec 6, 2001
                                  • 0 Attachment
                                    > Thank you, Nikolai. This looks promising, but I'm having problems
                                    > making it work. Here's the code (slightly adapted) I'm using, and it
                                    > basically just spits out the text content of the elements with a
                                    > bunch of white space between them.

                                    Hmm. For me, it worked in Saxon, XT, and Xalan after correcting several
                                    evident misprints. Below is the full text of my testing stylesheet.

                                    My guess: you have result indenting turned on. You need to insert

                                    <xsl:output method="xml" indent="no"/>

                                    at the top of your stylesheet, to limit XSLT processor's freedom
                                    to rearrange white space.

                                    Regards,
                                    Nikolai

                                    P.S. Here's what I used for test. It's identity transformation,
                                    plus the template that I posted originally.

                                    <xsl:stylesheet version="1.0"
                                    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
                                    <xsl:output method="xml" indent="no"/>

                                    <!-- Everything but test nodes: identity transformation -->
                                    <xsl:template match="/|*|@*|comment()|processing-instruction()">
                                    <xsl:copy>
                                    <xsl:apply-templates
                                    select="*|@*|text()|comment()|processing-instruction()"/>
                                    </xsl:copy>
                                    </xsl:template>


                                    <!-- Text nodes: intercalate with zwsp's -->
                                    <xsl:template match="text()">
                                    <xsl:call-template name="intersperse-with-zero-spaces">
                                    <xsl:with-param name="str" select="."/>
                                    </xsl:call-template>
                                    </xsl:template>

                                    <!-- Actual intercalation: recursive -->
                                    <xsl:template name="intersperse-with-zero-spaces">
                                    <xsl:param name="str"/>
                                    <xsl:variable name="spacechars">

                                          
                                         ​
                                    </xsl:variable>

                                    <xsl:if test="string-length($str) > 0">
                                    <xsl:variable name="c1"
                                    select="substring($str, 1, 1)"/>
                                    <xsl:variable name="c2"
                                    select="substring($str, 2, 1)"/>

                                    <xsl:value-of select="$c1"/>
                                    <xsl:if test="$c2 != '' and
                                    not(contains($spacechars, $c1) or
                                    contains($spacechars, $c2))">
                                    <xsl:text>​</xsl:text>
                                    </xsl:if>

                                    <xsl:call-template name="intersperse-with-zero-spaces">
                                    <xsl:with-param name="str" select="substring($str, 2)"/>
                                    </xsl:call-template>
                                    </xsl:if>
                                    </xsl:template>

                                    </xsl:stylesheet>
                                  • Nikolai Grigoriev
                                    Hi, ... Two things: 1) my original post contained an error that still persists in your stylesheet: the last character in each text node will be stripped. For
                                    Message 17 of 19 , Dec 6, 2001
                                    • 0 Attachment
                                      Hi,

                                      > Ah, progress: taking out the mode="insert-zero-spaces" attribute from
                                      > the first template gets me strings with embedded nonprintable
                                      > characters, which is a lot closer. More to follow...

                                      Two things:

                                      1) my original post contained an error that still persists in your stylesheet:
                                      the last character in each text node will be stripped. For fix, see my previous
                                      mail;

                                      2) I put it in a separate mode because I thought it should be applicable to
                                      text only inside table cells. It is convenient to switch modes in these cases.

                                      Regards,
                                      Nikolai
                                    • barrett808
                                      I have Nikolai s code working just right for my purpose, and after some hacking on my instance document, I can get XEP to render it. XEP complains about
                                      Message 18 of 19 , Dec 7, 2001
                                      • 0 Attachment
                                        I have Nikolai's code working just right for my purpose, and after
                                        some hacking on my instance document, I can get XEP to render it. XEP
                                        complains about xml:space, and spuriously complains about fo:page-
                                        sequence needing master-name to be declared (it is), also doesn't
                                        handle UTF-16 encoding. (Apache FOP complains about many basic FO
                                        attributes being not-yet-implemented and produces completely screwed-
                                        up output; XSL Formatter doesn't seem to understand zero-width
                                        characters at all).

                                        But after hacking my document to make XEP happy, what comes out is
                                        suboptimal: it appears the zero-width space characters (Unicode 200B)
                                        are being rendered as regular spaces. Same with the hair-width char
                                        (200A).

                                        So it appears I don't have a real solution. :(
                                      • dvd@renderx.com
                                        ... This is a difference between the obsolete XSL FO C(andidate)R and the current XSL FO Recommendation. In the Candidate fo:page-sequence had attributed named
                                        Message 19 of 19 , Dec 8, 2001
                                        • 0 Attachment
                                          >
                                          >
                                          > I have Nikolai's code working just right for my purpose, and after
                                          > some hacking on my instance document, I can get XEP to render it. XEP
                                          > complains about xml:space, and spuriously complains about fo:page-
                                          > sequence needing master-name to be declared (it is), also doesn't

                                          This is a difference between the obsolete XSL FO C(andidate)R and
                                          the current XSL FO Recommendation. In the Candidate fo:page-sequence
                                          had attributed named 'master-name'. In the final Recommendation it
                                          was renamed to 'master-reference'. The phrase 'master-name needs to be
                                          declared for' means that it is not declared in the DTD the xml is being
                                          validated against, as opposite to be DEFINED in the xml (xsl fo file)
                                          itself.

                                          The diagnostics means that master-name is NOT DECLARED In the DTD and
                                          thus is not allowed in your XSL FO. Upgrade your stylesheets and
                                          you'll get rid off the message.

                                          > handle UTF-16 encoding.

                                          This is not an issue with XEP. Any SAX XML parser may be plugged into,
                                          thus just choose one that supports encodings you need.

                                          > But after hacking my document to make XEP happy, what comes out is
                                          > suboptimal: it appears the zero-width space characters (Unicode 200B)
                                          > are being rendered as regular spaces. Same with the hair-width char
                                          > (200A).

                                          200A and 200b are rendered differently. 200b is just removed from the
                                          output. 200b is used internally to mark places where line breaks are appropriate,
                                          and if it looked like a space that would be obvious. It is not rendered.

                                          David Tolpin
                                        Your message has been successfully submitted and would be delivered to recipients shortly.