Hello,
I am trying to create a PDF with marginalias (side notes) with Apache FOP 1.0.
Since FOP does not support the "float" concept of FO, I am trying to use a
table with two columns; the first one for the marginalia, the second one for
the main text.
As the marginalia can consist of more lines than the following main text, I am
trying to use a table inside of a table:
Here is the xml (the number and order of maintextX and marginaliaX varies):
<root>
...
<body>
<marginalia1>number</marginalia1>
<title>title</title>
<body_info>
<maintext1>ipsum lorem</maintext1>
<maintext2>consectetur</maintext2>
<marginalia2>ut enim</marginalia2>
<maintext2>consequat r</maintext2>
<maintext3>consequat r</maintext3>
<marginalia2>ut enim</marginalia1>
<maintext4>consequat r</maintext4>
<body_info>
</body>
...
</root>
My PDF output should look like this:
-----------------------------------------------
| <marginalia1> | (Nested table:) <title> |
| | |
| |-----------------------------|
| | (Nested table:) <maintext1> |
| | |
| |-----------------------------|
| | (Nested table:) <maintext2> |
| | |
|---------------------------------------------|
| <marginalia2> | (Nested table:) <maintext2> |
| | |
| |-----------------------------|
| | (Nested table:) <maintext3> |
| | |
|---------------------------------------------|
| <marginalia3> | (Nested table:) <maintext4> |
| | |
-----------------------------------------------
But with my stylesheet below the table looks like this, of course:
-----------------------------------------------
| <marginalia1> | (Nested table:) <title> |
| | |
| |-----------------------------|
| | (Nested table:) <maintext1> |
| | |
| |-----------------------------|
| | (Nested table:) <maintext2> |
| | |
| |-----------------------------|
| | (Nested table:) <maintext2> |
| | |
| |-----------------------------|
| | (Nested table:) <maintext3> |
| | |
| |-----------------------------|
| | (Nested table:) <maintext4> |
| | |
|---------------------------------------------|
| <marginalia2> | (Nested table:) <maintext1> |
| | |
| |-----------------------------|
| | (Nested table:) <maintext2> |
| | |
| |-----------------------------|
| | (Nested table:) <maintext2> |
| | |
| |-----------------------------|
| | (Nested table:) <maintext3> |
| | |
| |-----------------------------|
| | (Nested table:) <maintext4> |
| | |
|---------------------------------------------|
| <marginalia3> | [etc] |
| | |
-----------------------------------------------
Here is my xslt:
...
<xsl:template match="body">
<fo:table table-layout="fixed" width="100%">
<fo:table-column column-width="51mm"/>
<fo:table-column column-width="109mm"/>
<fo:table-body>
<xsl:call-template name="marginalia"/>
</fo:table-body>
</fo:table>
</xsl:template>
<xsl:template name="marginalia">
<xsl:for-each select="marginalia1">
<fo:table-row>
<fo:table-cell border-width="0.1mm" border-style="solid">
<fo:block>
<xsl:value-of select="."/>
</fo:block>
</fo:table-cell>
<fo:table-cell border-width="0.1mm" border-style="solid">
<fo:table table-layout="fixed" width="100%">
<fo:table-column column-width="109mm"/>
<fo:table-body>
<xsl:apply-templates select="parent::body/title"/>
<xsl:apply-templates select="parent::body/body_info" />
</fo:table-body>
</fo:table>
</fo:table-cell>
</fo:table-row>
</xsl:for-each>
<xsl:for-each select="body_info/marginalia2">
<fo:table-row>
<fo:table-cell border-width="0.1mm" border-style="solid">
<fo:block>
<fo:inline>
<xsl:value-of select="."/>
</fo:inline>
</fo:block>
</fo:table-cell>
<fo:table-cell border-width="0.1mm" border-style="solid">
<fo:table table-layout="fixed" width="100%">
<fo:table-column column-width="109mm"/>
<fo:table-body>
<xsl:apply-templates select="ancestor::body/body_info" />
</fo:table-body>
</fo:table>
</fo:table-cell>
</fo:table-row>
</xsl:for-each>
</xsl:template>
<xsl:template match="maintext2"> <!-- and maintext3 and 4 -->
<fo:table-row>
<fo:table-cell border-width="0.1mm" border-style="solid">
<fo:block>
<fo:inline xsl:use-attribute-sets="text">
<xsl:value-of select="."/>
</fo:inline>
</fo:block>
</fo:table-cell>
</fo:table-row>
</xsl:template>
I don't know how to arrange the template to get the desired way.
Has anybody a helpful hint? Or maybe it is not possible at all?
Thank you very much.
Gerhard
--
Gerhard Glatz
Sophienstraße 93
76135 Karlsruhe
Fon: 0721/691650
Mobil: 0163/9041413
Neu: GMX De-Mail - Einfach wie E-Mail, sicher wie ein Brief!
Jetzt De-Mail-Adresse reservieren: http://portal.gmx.net/de/go/demail
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--