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

strange whitespace after fo:basic-link (sorry)

Expand Messages
  • Born, Matthias
    hi! i m using docbook-elements but not the docbook-stylesheets to write a few documents. now i ve following problem: a para with abbreviations, separeted by
    Message 1 of 3 , Aug 24, 2002
      hi!

      i'm using docbook-elements but not the docbook-stylesheets to write a
      few documents.

      now i've following problem:

      a para with abbreviations, separeted by ','

      <para>
      text text <abbrev xreflabel="pdf">PDF</abbrev>, <abbrev
      xreflabel="ps">PS</abbrev> text text
      <para>

      and the template

      <xsl:template match="abbrev[parent::para]">
      <fo:basic-link internal-destination="{generate-id(key('glossentries',
      @xreflabel))}">
      <fo:inline text-decoration="underline">
      <xsl:apply-templates/>
      </fo:inline>
      </fo:basic-link>
      </xsl:template>

      creates a strange whitespace(all whitespaces shown as '_') after the
      abbreviation:

      text text PDF_,_PS_text_text

      (imagine PDF an PS are underlined)

      do you 'see' the whitespace after PDF?

      some idea to avoid this?

      thx!

      matze
    • narinder_g
      hi matze the basic-link and inline element can contain text, so any new line character is converted to a space. Remove the extra newline characters and try.
      Message 2 of 3 , Aug 25, 2002
        hi matze
        the basic-link and inline element can contain text, so any new line
        character is converted to a space. Remove the extra newline
        characters and try.

        Like this..

        <xsl:template match="abbrev[parent::para]">
        <fo:basic-link internal-destination="{generate-id(key('glossentries',
        @xreflabel))}"><fo:inline text-decoration="underline"><xsl:apply-
        templates/></fo:inline></fo:basic-link>
        </xsl:template>

        hope this helps
        narinder
        --- In XSL-FO@y..., "Born, Matthias" <news@m...> wrote:
        > hi!
        >
        > i'm using docbook-elements but not the docbook-stylesheets to write
        a
        > few documents.
        >
        > now i've following problem:
        >
        > a para with abbreviations, separeted by ','
        >
        > <para>
        > text text <abbrev xreflabel="pdf">PDF</abbrev>, <abbrev
        > xreflabel="ps">PS</abbrev> text text
        > <para>
        >
        > and the template
        >
        > <xsl:template match="abbrev[parent::para]">
        > <fo:basic-link internal-destination="{generate-id(key
        ('glossentries',
        > @xreflabel))}">
        > <fo:inline text-decoration="underline">
        > <xsl:apply-templates/>
        > </fo:inline>
        > </fo:basic-link>
        > </xsl:template>
        >
        > creates a strange whitespace(all whitespaces shown as '_') after the
        > abbreviation:
        >
        > text text PDF_,_PS_text_text
        >
        > (imagine PDF an PS are underlined)
        >
        > do you 'see' the whitespace after PDF?
        >
        > some idea to avoid this?
        >
        > thx!
        >
        > matze
      • G. Ken Holman
        ... If that turns out to work, then the XSLT processor you are using is not performing properly. Narinder is correct about newlines being converted into
        Message 3 of 3 , Aug 26, 2002
          At 2002-08-26 04:15 +0000, narinder_g wrote:
          >hi matze
          >the basic-link and inline element can contain text, so any new line
          >character is converted to a space. Remove the extra newline
          >characters and try.
          >
          >Like this..
          >
          ><xsl:template match="abbrev[parent::para]">
          ><fo:basic-link internal-destination="{generate-id(key('glossentries',
          >@xreflabel))}"><fo:inline text-decoration="underline"><xsl:apply-
          >templates/></fo:inline></fo:basic-link>
          ></xsl:template>

          If that turns out to work, then the XSLT processor you are using is not
          performing properly.

          Narinder is correct about newlines being converted into spaces, but an XSLT
          processor must ignore white-space-only text nodes in the XSLT stylesheet:

          >--- In XSL-FO@y..., "Born, Matthias" <news@m...> wrote:
          > > now i've following problem:
          > >
          > > a para with abbreviations, separeted by ','
          > >
          > > <para>
          > > text text <abbrev xreflabel="pdf">PDF</abbrev>, <abbrev
          > > xreflabel="ps">PS</abbrev> text text
          > > <para>
          > >
          > > and the template
          > >
          > > <xsl:template match="abbrev[parent::para]">
          > > <fo:basic-link internal-destination="{generate-id(key
          >('glossentries',
          > > @xreflabel))}">
          > > <fo:inline text-decoration="underline">
          > > <xsl:apply-templates/>
          > > </fo:inline>
          > > </fo:basic-link>
          > > </xsl:template>
          > >
          > > creates a strange whitespace(all whitespaces shown as '_') after the
          > > abbreviation:
          > >
          > > text text PDF_,_PS_text_text

          In your original post, I see only white-space-only text nodes between the
          elements in the stylesheet, therefore I assumed that was not where your
          extraneous white-space before the comma was detected.

          On further thought I wonder if, perhaps, you are using indent="yes" on an
          xsl:output instruction. Many of my students have learned in my classes
          that this attribute is fine for debugging an XSLT stylesheet but it is not
          benign when trying to produce final results. I counsel my students to not
          use indent="yes" because they don't have any control over where the XSLT
          processor injects arbitrary white-space into the result tree.

          So, if you are using indent="yes" then your processor may be putting a
          newline after the nodes of your template which would then trigger the
          excess space.

          Have you looked at the XML serialization of your XSL-FO result tree to
          diagnose what kind of white-space is in your XSL-FO document to trigger the
          space before the comma? This may give you a clue.

          I hope this helps.

          ................... Ken


          --
          Upcoming hands-on in-depth 3-days XSLT/XPath and/or 2-days XSL-FO:
          - North America: Sep 30-Oct 4,2002
          - Japan: Oct 7-Oct 11,2002

          G. Ken Holman mailto:gkholman@...
          Crane Softwrights Ltd. http://www.CraneSoftwrights.com/f/
          Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (Fax:-0995)
          ISBN 0-13-065196-6 Definitive XSLT and XPath
          ISBN 1-894049-08-X Practical Transformation Using XSLT and XPath
          ISBN 1-894049-07-1 Practical Formatting Using XSLFO
          XSL/XML/DSSSL/SGML/OmniMark services, books (electronic, printed),
          articles, training (instructor-live,Internet-live,web/CD,licensed)
          Next public training: 2002-08-26,27,09-30,10-03,07,10,12-08
        Your message has been successfully submitted and would be delivered to recipients shortly.