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

Problem with wrapping of table

Expand Messages
  • mum_guy23
    Hi, The problem is that I have to indent the PDF indentation should be like. 1 some text 1.1 some text 1.1.1 some text ................ ................ for
    Message 1 of 2 , Jul 24, 2003
    • 0 Attachment
      Hi,
      The problem is that I have to
      indent the PDF indentation should be like.

      1 some text
      1.1 some text
      1.1.1 some text
      ................
      ................

      for determining the level I have only the question
      numbers i.e 1,1.1. The maximum level i know is 6. What
      currently iam doing is I ve defind a table for this as



      <fo:table table-layout="fixed" start-indent="100%"
      space-before.optimum="6pt" space-after.optimum="6pt"
      font-size="10pt" color="black">
      <fo:table-column column-width="7%" column-number="1"/>
      <fo:table-column column-width="4%" column-number="2"/>
      <fo:table-column column-width="4%" column-number="3"/>
      <fo:table-column column-width="4%" column-number="4"/>
      <fo:table-column column-width="81%"
      column-number="5"/>
      <fo:table-column column-width="0%" column-number="6"/>
      <fo:table-body>

      <fo:table-cell>
      <xsl:if test="not(contains(questionnumber,'.'))">
      <xsl:attribute
      name="number-columns-spanned">1</xsl:attribute>
      </xsl:if>
      <xsl:if test="contains(questionnumber,'.')">
      <xsl:call-template name="loop">
      <xsl:with-param name="counter">1</xsl:with-param>
      <xsl:with-param name="val" select="questionnumber"/>
      </xsl:call-template>
      </xsl:if>
      <fo:block text-align="center">
      <xsl:value-of select="questionnumber"/>
      </fo:block>
      </fo:table-cell>
      <fo:table-cell>
      <xsl:if test="not(contains(questionnumber,'.'))">
      <xsl:attribute
      name="number-columns-spanned">4</xsl:attribute>
      </xsl:if>
      <xsl:if test="contains(questionnumber,'.')">
      <xsl:call-template name="loop1">
      <xsl:with-param name="counter1">1</xsl:with-param>
      <xsl:with-param name="val1"
      select="questionnumber"/>
      </xsl:call-template>
      </xsl:if>
      <xsl:attribute
      name="background-color">#E9E9E9</xsl:attribute>


      The functions Loop and Loop 1 are defined as..

      <xsl:template name="loop">
      <xsl:param name="counter"/>
      <xsl:param name="val"/>
      <xsl:if test="$val != ''">
      <xsl:call-template name="loop">
      <xsl:with-param name="counter" select="$counter
      + 1"/>
      <xsl:with-param name="val"
      select="substring-after($val, '.')"/>
      </xsl:call-template>
      </xsl:if>
      <xsl:if test="$val = ''">
      <xsl:attribute
      name="number-columns-spanned"><xsl:value-of select =
      "$counter - 1"/></xsl:attribute>
      </xsl:if>
      </xsl:template>



      <xsl:template name="loop1">
      <xsl:param name="counter1"/>
      <xsl:param name="val1"/>
      <xsl:if test="$val1 != ''">
      <xsl:call-template name="loop1">
      <xsl:with-param name="counter1"
      select="$counter1 + 1"/>
      <xsl:with-param name="val1"
      select="substring-after($val1, '.')"/>
      </xsl:call-template>
      </xsl:if>
      <xsl:if test="$val1 = ''">
      <xsl:attribute
      name="number-columns-spanned"><xsl:value-of select =
      "6 - $counter1"/></xsl:attribute>
      </xsl:if>
      </xsl:template>

      The above approach is working fine. ALso I tested on my local
      Websphere application enviornment. But in
      actual production enviornment(Unix) it is giving
      unexpected results. Its not taking the number of column spanned and
      even harcodded number-columns-spanned are ignored. Even the in first
      table i ve defined for table of contents is ignoring the number-of-
      columns spanned.

      Also for same xml sometime its printing the correct output and
      sometimes wrapped output is printed.

      Hope to get solution soon.

      Thanks,
      Anshul Katoch
    • G. Ken Holman
      ... Why are you using a table? Why not just an increasing value for the start-indent= property? ... One cannot comment on this without an example of what you
      Message 2 of 2 , Jul 24, 2003
      • 0 Attachment
        At 2003-07-24 09:02 +0000, mum_guy23 wrote:
        >The problem is that I have to
        >indent the PDF indentation should be like.
        >
        >1 some text
        > 1.1 some text
        > 1.1.1 some text
        > ................
        > ................
        >
        >for determining the level I have only the question
        >numbers i.e 1,1.1. The maximum level i know is 6. What
        >currently iam doing is I ve defind a table for this

        Why are you using a table? Why not just an increasing value for the
        start-indent= property?

        >Also for same xml sometime its printing the correct output and
        >sometimes wrapped output is printed.

        One cannot comment on this without an example of what you are doing ... but
        suffice to say that when are using the table construct as a layout
        construct (nothing wrong with doing so) and you end up needing complex
        specifications of row and column spanning, perhaps your calculations are
        not keeping up with your requirements.

        Surely for a simple indentation requirement one could just use indentation
        ... are there other requirements you are not mentioning?

        I hope this helps.

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

        --
        Upcoming hands-on courses: in-house corporate training available;
        North America public: XSL-FO Aug 4,2003; XSLT/XPath Aug 12, 2003

        G. Ken Holman mailto:gkholman@...
        Crane Softwrights Ltd. http://www.CraneSoftwrights.com/f/
        Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995)
        ISBN 0-13-065196-6 Definitive XSLT and XPath
        ISBN 0-13-140374-5 Definitive XSL-FO
        ISBN 1-894049-08-X Practical Transformation Using XSLT and XPath
        ISBN 1-894049-11-X Practical Formatting Using XSL-FO
        Member of the XML Guild of Practitioners: http://XMLGuild.info
        Male Breast Cancer Awareness http://www.CraneSoftwrights.com/f/bc
      Your message has been successfully submitted and would be delivered to recipients shortly.