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

xslt to generate table-layout=fixed

Expand Messages
  • isterin
    Hello, I currently have an XSLT that transforms XML to XSL-FO. We re using FOP as the engine. Since FOP only supports table-layout= fixed , I m in a small
    Message 1 of 2 , Feb 21, 2005
    • 0 Attachment
      Hello, I currently have an XSLT that transforms XML to XSL-FO. We're
      using FOP as the engine.

      Since FOP only supports table-layout="fixed", I'm in a small bind.

      The XSLT transforms regular XHTML tables to XSL-FO tables. Since in
      HTML we don't know how many columns the table will hold before hand, I
      can't seem to figure out a way to generate a fixed table layout in FO,
      since I'm not sure how many fo:table-column elements will be present
      in each table.

      Has anyone ever come up with a solution for something similar. I
      googled for some XSLT/XPath way of solving this, and most solutions
      lead to having a columns="#" attribute in the table element. Since we
      can't enforce this, is there another way of possibly counting the
      columns in say the first row, to generate the fo:table-column elements?

      What's the most elegant way of resolving this?

      Thanks in advance for any help.

      Ilya
    • Dave Pawson
      ... You could recurse through the table and count rows, returning the max() or, as you say, take the count of the first row as being representative.
      Message 2 of 2 , Feb 21, 2005
      • 0 Attachment
        On Mon, 2005-02-21 at 15:32 +0000, isterin wrote:

        > Has anyone ever come up with a solution for something similar. I
        > googled for some XSLT/XPath way of solving this, and most solutions
        > lead to having a columns="#" attribute in the table element. Since we
        > can't enforce this, is there another way of possibly counting the
        > columns in say the first row, to generate the fo:table-column elements?

        You could recurse through the table and count rows,
        returning the max()

        or, as you say, take the count of the first row as being
        representative.

        match=table
        var
        value = count(row[1]/cell)



        Depends how regular your input data is?

        HTH DaveP
      Your message has been successfully submitted and would be delivered to recipients shortly.