This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: Dynamic Tables in FO
- To: "Xsl-List (E-mail)" <xsl-list at lists dot mulberrytech dot com>
- Subject: RE: [xsl] Dynamic Tables in FO
- From: Anthony Ikeda <anthony dot ikeda at proxima-tech dot com>
- Date: Fri, 22 Dec 2000 09:41:12 +1100
- Reply-To: xsl-list at lists dot mulberrytech dot com
Thanks Jeni, I actually found out what was wrong, I had to change the code
so that the match for jncTable existed in the for each (for some unknown
reason) so I have:
<xsl:template name="111">
<fo:block font-size="9pt">
<fo:table>
<fo:table-column column-width="20mm"/>
<fo:table-column column-width="90mm"/>
<fo:table-column column-width="30mm"/>
<fo:table-body>
<xsl:choose>
<xsl:when test="//section/@number='11.1'">"
<xsl:for-each
select="//jncTable/jncTableRow">
<fo:table-row>
<xsl:for-each
select="jncTableHeader | jncTableItem">
<fo:table-cell>
<fo:block><xsl:value-of select="." /></fo:block>
</fo:table-cell>
</xsl:for-each>
</fo:table-row>
</xsl:for-each>
</xsl:when>
</xsl:choose>
</fo:table-body>
</fo:table>
</fo:block>
</xsl:template>
It seems the template declaration for match="jncTable" was causing the
problem.
Thanks,
Anthony Ikeda,
Web Application Developer,
Proxima Technology,
Level 13,
181 Miller Street,
North Sydney
Australia
PH: +612-9458-1718
Mob: 041 624 5143
> -----Original Message-----
> From: Jeni Tennison [mailto:mail@jenitennison.com]
> Sent: Thursday, 21 December 2000 9:40 PM
> To: Anthony Ikeda
> Cc: Xsl-List (E-mail)
> Subject: Re: [xsl] Dynamic Tables in FO
>
>
> Hi Anthony,
>
> > Okay, I have some XML code that represents a table structure syntax,
> > much the way it does in html. However, I'm having problems
> > generating the code to PDF.
>
> One possibility is that you're creating empty table rows, which aren't
> allowed. The relevant part of the XSLT is:
>
> > <xsl:for-each select="./jncTableRow">
> > <fo:table-row>
> > <!-- headers section... -->
> > <xsl:for-each select="./jncTableHeader">
> > <fo:table-cell>
> > <fo:block>
> > <xsl:value-of select="."/>
> > </fo:block>
> > </fo:table-cell>
> > </xsl:for-each>
> > <!-- ...headers section -->
> > </fo:table-row>
> > <fo:table-row>
> > <!-- data section... -->
> > <xsl:for-each select="./jncTableItem">
> > <fo:table-cell>
> > <fo:block>
> > <xsl:value-of select="."/>
> > </fo:block>
> > </fo:table-cell>
> > </xsl:for-each>
> > <!-- ...data section -->
> > </fo:table-row>
> > </xsl:for-each>
>
> Here, you're going through each jncTableRow in your XML source, and
> for each of them first making a row that holds cells for each of the
> jncTableHeader elements it holds and then making a row that holds
> cells for each of the jncTableItem elements it holds. If you look at
> your source XML, only the first jncTableRow holds jncTableHeader
> elements, and it doesn't hold any jncTableItem elements. So the first
> jncTableRow creates one row with cells in it for each of the headers,
> and another row with nothing in; the rest of the jncTableRows create
> one row with nothing in, and another row holding the items.
>
> What you want to do is have each of the jncTableRows create a row with
> the a cell for each of the jncTableHeader *or* jncTableItem elements
> that it holds. [As an aside, you can also stop putting ./ at the
> front of each XPath: it's completely redundant and will just slow
> things down.] So, you want something like:
>
> <xsl:for-each select="jncTableRow">
> <fo:table-row>
> <xsl:for-each select="jncTableHeader | jncTableItem">
> <fo:table-cell>
> <fo:block><xsl:value-of select="." /></fo:block>
> </fo:table-cell>
> </xsl:for-each>
> </fo:table-row>
> </xsl:for-each>
>
> I've no idea whether that will help as I know nothing about XSL-FO,
> but it's probably worth a shot.
>
> Cheers,
>
> Jeni
>
> ---
> Jeni Tennison
> http://www.jenitennison.com/
>
>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list