5

The following feature isn't implemented by Apache FOP, yet: table-layout="auto" (on fo:table)

I am getting above warning in console . I am trying to do export to doc. With same XML and XSLT my export to PDF is working but export to doc gives blank document.

--------------- My XML -----------------------------

    <?xml version="1.0" encoding="UTF-8"?>
    <export>
        <signPost>
            <organisationName>Organisation NEW TEST1</organisationName>
            <address1>Address Line 1</address1>
            <address2>Address Line 2</address2>
            <address3>Address Line 3</address3>
            <postCode>N194eh</postCode>
            <phNumber>07999999999</phNumber>
            <email>newmeh@meh.com</email>
            <url>www.NOTnewmeh.com</url>
            <profile>tee</profile>
        </signPost>
        <signPost>
            <organisationName>Test Meta Organization</organisationName>
            <address1 />
            <address2 />
            <address3 />
            <postCode>N194EH</postCode>
            <phNumber />
            <email />
            <url />
            <profile />
        </signPost>
        <signPost>
            <organisationName>Test Org Meta</organisationName>
            <address1>Address Line 1</address1>
            <address2>Address Line 2</address2>
            <address3>Address Line 3</address3>
            <postCode>N194EH</postCode>
            <phNumber>07999999999</phNumber>
            <email>newmeh@meh.com</email>
            <url>www.NOTnewmeh.com</url>
            <profile>Profile</profile>
        </signPost>
        <signPost>
            <organisationName>eeeeeewe</organisationName>
            <address1>Address Line 1</address1>
            <address2>tee</address2>
            <address3>Address Line 3</address3>
            <postCode>n124jj</postCode>
            <phNumber>07777777777</phNumber>
            <email>meh@meh.com</email>
            <url>meh.com</url>
            <profile>Profile</profile>
        </signPost>
        <signPost>
            <organisationName>sdfsdfs</organisationName>
            <address1>Address Line 1</address1>
            <address2>Address Line 2</address2>
            <address3>Address Line 3</address3>
            <postCode>a332kk</postCode>
            <phNumber>07999999999</phNumber>
            <email>newmeh@meh.com</email>
            <url>www.NOTnewmeh.com</url>
            <profile>Profile</profile>
        </signPost>
        <signPost>
            <organisationName>this</organisationName>
            <address1>Address Line 1</address1>
            <address2>Address Line 2</address2>
            <address3>Address Line 3</address3>
            <postCode>n377mm</postCode>
            <phNumber>07999999999</phNumber>
            <email>newmeh@meh.com</email>
            <url>www.NOTnewmeh.com</url>
            <profile>Profile</profile>
        </signPost>
        <signPost>
            <organisationName>New Org</organisationName>
            <address1>Address Line 1</address1>
            <address2>Address Line 2</address2>
            <address3>Address Line 3</address3>
            <postCode>NW1 2SD</postCode>
            <phNumber>07999999999</phNumber>
            <email>newmeh@meh.com</email>
            <url>www.NOTnewmeh.com</url>
            <profile>Profile</profile>
        </signPost>
    </export>

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

----- MY XSLT -----------------------------

<?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:template match="/">

        <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
            <fo:layout-master-set>
                <fo:simple-page-master master-name="form"
                    page-height="29.7cm" page-width="21.0cm" margin-right="2cm"
                    margin-left="1cm" margin-top="1cm" margin-bottom="0cm">
                    <fo:region-body margin-top="1cm" margin-bottom="1cm" />
                    <fo:region-before region-name="header" extent="1cm" />
                    <fo:region-after region-name="footer" extent="1cm" />
                </fo:simple-page-master>
            </fo:layout-master-set>

            <fo:page-sequence master-reference="form">
                <fo:flow flow-name="xsl-region-body">
                    <xsl:apply-templates select="export" />
                </fo:flow>
            </fo:page-sequence>

        </fo:root>
    </xsl:template>

    <xsl:template match="export">
        <fo:table  >

            <fo:table-body>
                <xsl:for-each select="signPost">
                    <xsl:choose>
                        <xsl:when test="position() mod 2 = 1">
                            <fo:table-row>
                                <fo:table-cell>
                                    <fo:block padding-top="2mm">
                                        <xsl:value-of select="organisationName" />
                                    </fo:block>

                                </fo:table-cell>
                            </fo:table-row>
                        </xsl:when>
                    </xsl:choose>

                </xsl:for-each>
            </fo:table-body>
        </fo:table>


    </xsl:template>

</xsl:stylesheet>

1 Answer 1

5

Try to add table-layout="fixed" in your fo:table, so that it becomes:

<fo:table table-layout="fixed">

You might also need to add the width of your table

<fo:table table-layout="fixed" width="100%">

If you still get the warning, try to define the width of your columns:

...
<fo:table-column column-width="30%"/>
<fo:table-body>
...

However, I doubt that you get a blank document because of this warning. What do you get if you do the following?

<xsl:template match="export">
    <fo:block>test</fo:block>
</xsl:template>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.