Subject: Re: [xsl] Dynamic Tables in FO From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx> Date: Thu, 21 Dec 2000 10:39:58 +0000 |
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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Dynamic Tables in FO, Anthony Ikeda | Thread | RE: [xsl] Dynamic Tables in FO, Anthony Ikeda |
Re: [xsl] How to select distinct co, David Carlisle | Date | AW: [xsl] Template priority, Heinz R., ITS P E320 |
Month |