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

What is wrong with my syntax?

Expand Messages
  • Adam
    Okay, I ve just begun to learn about XML/XSL-FO and I am trying to create a table in the PDF output. However, whenever I FOP (0.20.4) it, I m not getting
    Message 1 of 4 , Jun 30, 2003
    • 0 Attachment
      Okay, I've just begun to learn about XML/XSL-FO and I am trying to create a table in
      the PDF output. However, whenever I FOP (0.20.4) it, I'm not getting anything in the
      resultant PDF. The PDF file would just be blank. The xml and xsl files I'm using are
      at http://homepage.mac.com/macbuff/xsl/item.xml and http://homepage.mac.com/
      macbuff/xsl/buffstuff.xsl respectively. What am I doing wrong?

      ----------

      //item.xml

      <?xml version="1.0"?>
      <mysqldump>
      <database name="buffstuff">
      <table name="item">
      <row>
      <field name="item_id">1</field>
      <field name="item_number">122</field>
      <field name="item_name">Brandon Doman</field>
      <field name="cardset_id">2</field>
      <field name="parallel">_</field>
      <field name="is_rc">1</field>
      <field name="serial_number_prefix">0</field>
      <field name="serial_number_suffix">0</field>
      <field name="autograph_id">3</field>
      <field name="subset">_</field>
      <field name="game_used_id">1</field>
      <field name="item_image">NA.gif</field>
      <field name="item_bimage">NA.gif</field>
      <field name="item_orientation">0</field>
      <field name="condition_id">1</field>
      <field name="description">_</field>
      <field name="game_used_image">1</field>
      <field name="item_status_id">1</field>
      <field name="person_id">1</field>
      <field name="date_of_transaction">0000-00-00 00:00:00</field>
      <field name="weight">0.00</field>
      <field name="beckett_high">0.00</field>
      <field name="beckett_low">0.00</field>
      <field name="beckett_issue">_</field>
      <field name="date_added">2003-06-07 00:00:00</field>
      <field name="last_modified_date">0000-00-00 00:00:00</field>
      <field name="quantity">1</field>
      </row>
      ....
      </table>
      </database>
      </mysqldump>

      ------------

      //buffstuff.xsl

      <?xml version="1.0" encoding="UTF-8"?>
      <xsl:stylesheet version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:fo="http://www.w3.org/1999/XSL/Format">

      <xsl:attribute-set name="inside-table">
      <xsl:attribute name="start-indent">0pt</xsl:attribute>
      <xsl:attribute name="text-align">start</xsl:attribute>
      </xsl:attribute-set>

      <xsl:template match="/">

      <fo:root
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:fo="http://www.w3.org/1999/XSL/Format"
      >
      <fo:layout-master-set>
      <fo:simple-page-master master-name="body"
      page-height="29.7cm"
      page-width="21cm"
      margin-top="1cm"
      margin-bottom="2cm"
      margin-left="2.5cm"
      margin-right="2.5cm"
      background-color="#ffffff"
      color="#000000">
      <fo:region-body margin-top="3cm"/>
      <fo:region-before extent="3cm"/>
      <fo:region-after extent="1.5cm"/>
      </fo:simple-page-master>
      </fo:layout-master-set>

      <fo:page-sequence master-reference="body">
      <fo:flow flow-name="xsl-region-body">

      <fo:block>
      <xsl:apply-templates />
      </fo:block>

      </fo:flow>
      </fo:page-sequence>
      </fo:root>

      </xsl:template>

      <xsl:template match="table">
      <fo:table-and-caption text-align="center" start-indent="100pt">
      <fo:table-caption xsl:use-attribute-sets="inside-table"></fo:table-
      caption>

      <fo:table width="540pt" table-layout="fixed">
      <fo:table-column column-width="20pt">
      <xsl:attribute name="column-number">27</xsl:attribute>
      </fo:table-column>

      <fo:table-body xsl:use-attribute-sets="inside-table">
      <xsl:apply-templates />
      </fo:table-body>


      </fo:table>

      </fo:table-and-caption>
      </xsl:template>

      <xsl:template match="row">
      <fo:table-row>
      <xsl:apply-templates />
      </fo:table-row>
      </xsl:template>

      <xsl:template match="field">
      <fo:table-cell>
      <xsl:value-of select="."/>
      </fo:table-cell>
      </xsl:template>

      </xsl:stylesheet>
    • Praveen Sam
      Looks like in your xml - you defined the root as which should be the template match in the xsl and I guess since it doesn t find a matching
      Message 2 of 4 , Jun 30, 2003
      • 0 Attachment
        Looks like in your xml - you defined the root as
        <mysqldump> which "should" be the 'template match' in
        the xsl and I guess since it doesn't find a matching
        template - its not rendering ...

        check that out and see with one tag at a time to see
        what's rendering and what's not .....

        hope this helps ...
        --- Adam <macbuff@...> wrote:
        > Okay, I've just begun to learn about XML/XSL-FO and
        > I am trying to create a table in
        > the PDF output. However, whenever I FOP (0.20.4)
        > it, I'm not getting anything in the
        > resultant PDF. The PDF file would just be blank.
        > The xml and xsl files I'm using are
        > at http://homepage.mac.com/macbuff/xsl/item.xml and
        > http://homepage.mac.com/
        > macbuff/xsl/buffstuff.xsl respectively. What am I
        > doing wrong?
        >
        > ----------
        >
        > //item.xml
        >
        > <?xml version="1.0"?>
        > <mysqldump>
        > <database name="buffstuff">
        > <table name="item">
        > <row>
        > <field name="item_id">1</field>
        > <field name="item_number">122</field>
        > <field name="item_name">Brandon Doman</field>
        > <field name="cardset_id">2</field>
        > <field name="parallel">_</field>
        > <field name="is_rc">1</field>
        > <field name="serial_number_prefix">0</field>
        > <field name="serial_number_suffix">0</field>
        > <field name="autograph_id">3</field>
        > <field name="subset">_</field>
        > <field name="game_used_id">1</field>
        > <field name="item_image">NA.gif</field>
        > <field name="item_bimage">NA.gif</field>
        > <field name="item_orientation">0</field>
        > <field name="condition_id">1</field>
        > <field name="description">_</field>
        > <field name="game_used_image">1</field>
        > <field name="item_status_id">1</field>
        > <field name="person_id">1</field>
        > <field name="date_of_transaction">0000-00-00
        > 00:00:00</field>
        > <field name="weight">0.00</field>
        > <field name="beckett_high">0.00</field>
        > <field name="beckett_low">0.00</field>
        > <field name="beckett_issue">_</field>
        > <field name="date_added">2003-06-07
        > 00:00:00</field>
        > <field name="last_modified_date">0000-00-00
        > 00:00:00</field>
        > <field name="quantity">1</field>
        > </row>
        > ....
        > </table>
        > </database>
        > </mysqldump>
        >
        > ------------
        >
        > //buffstuff.xsl
        >
        > <?xml version="1.0" encoding="UTF-8"?>
        > <xsl:stylesheet version="1.0"
        > xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        > xmlns:fo="http://www.w3.org/1999/XSL/Format">
        >
        > <xsl:attribute-set name="inside-table">
        > <xsl:attribute
        > name="start-indent">0pt</xsl:attribute>
        > <xsl:attribute
        > name="text-align">start</xsl:attribute>
        > </xsl:attribute-set>
        >
        > <xsl:template match="/">
        >
        > <fo:root
        > xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        > xmlns:fo="http://www.w3.org/1999/XSL/Format"
        > >
        > <fo:layout-master-set>
        > <fo:simple-page-master master-name="body"
        > page-height="29.7cm"
        > page-width="21cm"
        > margin-top="1cm"
        > margin-bottom="2cm"
        > margin-left="2.5cm"
        > margin-right="2.5cm"
        > background-color="#ffffff"
        > color="#000000">
        > <fo:region-body margin-top="3cm"/>
        > <fo:region-before extent="3cm"/>
        > <fo:region-after extent="1.5cm"/>
        > </fo:simple-page-master>
        > </fo:layout-master-set>
        >
        > <fo:page-sequence master-reference="body">
        > <fo:flow flow-name="xsl-region-body">
        >
        > <fo:block>
        > <xsl:apply-templates />
        > </fo:block>
        >
        > </fo:flow>
        > </fo:page-sequence>
        > </fo:root>
        >
        > </xsl:template>
        >
        > <xsl:template match="table">
        > <fo:table-and-caption text-align="center"
        > start-indent="100pt">
        > <fo:table-caption
        > xsl:use-attribute-sets="inside-table"></fo:table-
        > caption>
        >
        > <fo:table width="540pt" table-layout="fixed">
        > <fo:table-column column-width="20pt">
        > <xsl:attribute
        > name="column-number">27</xsl:attribute>
        > </fo:table-column>
        >
        > <fo:table-body
        > xsl:use-attribute-sets="inside-table">
        > <xsl:apply-templates />
        > </fo:table-body>
        >
        >
        > </fo:table>
        >
        > </fo:table-and-caption>
        > </xsl:template>
        >
        > <xsl:template match="row">
        > <fo:table-row>
        > <xsl:apply-templates />
        > </fo:table-row>
        > </xsl:template>
        >
        > <xsl:template match="field">
        > <fo:table-cell>
        > <xsl:value-of select="."/>
        > </fo:table-cell>
        > </xsl:template>
        >
        > </xsl:stylesheet>
        >
        >


        =====


        __________________________________
        Do you Yahoo!?
        SBC Yahoo! DSL - Now only $29.95 per month!
        http://sbc.yahoo.com
      • Chris Bowditch
        See comments below ... ... FOP doesnt support table-and-caption. Delete the table-and-caption element and just try fo:table. When you get plain tables
        Message 3 of 4 , Jul 1, 2003
        • 0 Attachment
          See comments below


          >From: "Adam" <macbuff@...>
          >

          <snip/>

          >
          >
          > <xsl:template match="table">
          > <fo:table-and-caption text-align="center" start-indent="100pt">
          > <fo:table-caption xsl:use-attribute-sets="inside-table"></fo:table-
          >caption>

          FOP doesnt support table-and-caption. Delete the table-and-caption element
          and just try fo:table. When you get plain tables working you can simulate
          table and caption using a nested table.

          >
          > <fo:table width="540pt" table-layout="fixed">

          FOP works better with inches or centimetres, e.g. width="8in" will have more
          chance of working as you expect

          > <fo:table-column column-width="20pt">
          > <xsl:attribute name="column-number">27</xsl:attribute>

          This bit is just plain wrong. You have defined just one column in your table
          (number 27). You need to have a fo:table-column element for every column
          that you want. So if there will be 27 columns you need 27x fo:table-column
          with numbers going 1, 2, 3, .... 27

          > </fo:table-column>
          >
          > <fo:table-body xsl:use-attribute-sets="inside-table">
          > <xsl:apply-templates />
          > </fo:table-body>
          >
          >
          > </fo:table>
          >
          > </fo:table-and-caption>
          > </xsl:template>
          >
          > <xsl:template match="row">
          > <fo:table-row>
          > <xsl:apply-templates />
          > </fo:table-row>
          > </xsl:template>
          >
          > <xsl:template match="field">
          > <fo:table-cell>
          > <xsl:value-of select="."/>
          > </fo:table-cell>
          > </xsl:template>
          >
          ></xsl:stylesheet>
          >

          _________________________________________________________________
          Use MSN Messenger to send music and pics to your friends
          http://www.msn.co.uk/messenger
        • Adam
          ... Removing the table-caption and table-and-caption and fixing the table-column solves this problem. Thanks. --Adam
          Message 4 of 4 , Jul 1, 2003
          • 0 Attachment
            --- In XSL-FO@yahoogroups.com, "Chris Bowditch" <bowditch_chris@h...> wrote:
            > See comments below
            >


            Removing the table-caption and table-and-caption and fixing the table-column
            solves this problem. Thanks.

            --Adam
          Your message has been successfully submitted and would be delivered to recipients shortly.