W3C home > Mailing lists > Public > www-xsl-fo@w3.org > September 2003

fo:table - how do you wrap around?

From: <michelleaiken-webboards9999@mailblocks.com>
Date: Thu, 04 Sep 2003 13:01:04 -0700
Message-Id: <8C541366825B088-3C0-67C@App2>
To: www-xsl-fo@w3.org

Hello,

I have an XML file that looks something like this:

<?xml version="1.0" encoding="utf-8"?>
<AddressInfo>
  <Customer Name="Bill McDonald" idx="A">
    <A1>925 Edward St.</A1>
    <City>Minneaplois</City>
    <State>MN</State>
    <ZIP>97401</ZIP>
  </Customer>
</AddressInfo>

There can be any number of these Contact elements.

Right now I am using a fo:table  to display them.
Here is a piece of the XSL:

<xsl:template match="AddressInfo">
    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
    <fo:layout-master-set>
        <fo:simple-page-master master-name="my-page">
        <fo:region-body margin="1.5cm" margin-right="1cm"/>
         <fo:region-after extent="0.5cm" margin="1.5cm" 
margin-bottom="1cm" />
        </fo:simple-page-master>
    </fo:layout-master-set>

    <fo:page-sequence master-reference="my-page">

        <fo:flow flow-name="xsl-region-body">
            <fo:table border="0.2pt solid black">
            <fo:table-column column-width="12cm"/>
            <fo:table-body>
		    <xsl:apply-templates select="Contact" />
            </fo:table-body>
            </fo:table>
        </fo:flow>
    </fo:page-sequence>
    </fo:root>
</xsl:template>

<xsl:template xmlns:fo="http://www.w3.org/1999/XSL/Format" 
match="Contact">

<fo:table-row keep-with-next.within-column="always"><xsl:attribute 
name="font"><xsl:value-of select="//BaseFont"/></xsl:attribute>
      <fo:table-cell padding-start="4pt" text-align="left">
        <fo:block> <xsl:value-of select="@Name" /></fo:block>
      </fo:table-cell>
    </fo:table-row>

... more templates for A1, city, state, etc.

</xsl:template>

The display looks something like this

Customer1 Name
Customer1 Address
Customer1 City, State, Zip
-------------------------------
Customer2 Name
Customer2 Address
Customer2 City, State, Zip
-------------------------------
Customer3 Name
Customer3 Address
Customer3 City, State, Zip
--------------------------------
Customer4 Name
Customer4 Address
Customer4 City, State, Zip

I want it to look like this:

Customer1 Name                            |  Customer2 Name
Customer1 Address                        |  Customer2 Address           

Customer1 City, State, Zip             |  Customer2 City, State, Zip
-----------------------------------------------------------------------------
Customer3 Name                            |  Customer4 Name
Customer3 Address                        |  Customer4 Address           

Customer3 City, State, Zip             |  Customer4 City, State, Zip

I can't just add another column because I need to loop through all the 
contacts in the xml file, and the second column would be the same as 
the first, just different data.  Anyone know how I can do this?  Is 
there some kind of table wrap-around attribute?

Thanks in advance for any help!

Michelle
Received on Friday, 5 September 2003 15:38:09 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 3 October 2007 16:06:11 GMT