You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Ryan Howe <ho...@yahoo.com> on 2002/02/14 00:14:10 UTC
PDF Table Template?
Hello,
I am attempting to use the stylesheet included below
to transform an XML file to PDF using Cocoon 2.0.1. My
hope to build multiple tables in the PDF file. I have
created two templates in the stylesheet for opening
and closing a table.
When running this through Cocoon, I get a
NullPointerException in Xalan
(TransformerImpl.run(TransformerImpl.java:3174)). If I
uncomment the <fo:table> tags in the stylesheet
comment the call to the two templates, it runs fine
through Cocoon.
Since I will create about 6 tables in this file, I
would like to have a template to open the table and
setup the columns instead of coding the same thing
several times.
Would anyone have any ideas how to get around this?
<?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:output method="xml" version="1.0"
encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<fo:root
xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master master-name="table-page"
page-height="600pt" page-width="850pt">
<fo:region-body region-name="table-region"
margin-left="25pt" margin-top="25pt"
margin-right="25pt" margin-bottom="25pt"/>
</fo:simple-page-master>
<fo:page-sequence-master
master-name="table-sequence">
<fo:repeatable-page-master-reference
master-reference="table-page"/>
</fo:page-sequence-master>
</fo:layout-master-set>
<fo:page-sequence
master-reference="table-sequence">
<fo:flow flow-name="table-region">
<fo:block font-size="8pt">
<!-- <fo:table border-style="solid"
table-omit-header-at-break="true"> -->
<xsl:call-template name="OpenPDFTable"/>
<fo:table-column column-number="1"
column-width="80pt"/>
<fo:table-column column-number="2"
column-width="80pt"/>
<fo:table-header border-style="solid">
<fo:table-row keep-with-next="always">
<fo:table-cell column-number="1"
number-columns-spanned="2" padding="2pt"
background-color="#003366">
<fo:block color="#FFFFFF">Total Mechandise
Discounts & Adjustments</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-header>
<fo:table-body>
<fo:table-row>
<fo:table-cell column-number="1"
border-style="solid" padding="2pt">
<fo:block>9099</fo:block>
</fo:table-cell>
<fo:table-cell column-number="2"
border-style="solid" padding="2pt">
<fo:block>NTB - SOUTH</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
<!-- </fo:table> -->
<xsl:call-template name="ClosePDFTable"/>
</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
<xsl:template name="OpenPDFTable">
<xsl:text disable-output-escaping="yes">
<fo:table border-style="solid"
table-omit-header-at-break="true">
</xsl:text>
</xsl:template>
<xsl:template name="ClosePDFTable">
<xsl:text disable-output-escaping="yes">
</fo:table>
</xsl:text>
</xsl:template>
</xsl:stylesheet>
__________________________________________________
Do You Yahoo!?
Send FREE Valentine eCards with Yahoo! Greetings!
http://greetings.yahoo.com
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>
Re: PDF Table Template?
Posted by Perry Molendijk <xi...@iinet.net.au>.
This is not a Cocoon error it's a fundamental XSLT error. Constructs like:
<xsl:text disable-output-escaping="yes">
</fo:table>
</xsl:text>
are bad.
If you want to use a named template for a table do this
<xsl:call-template name="table-template"/>
<xsl:template name="table-template">
<fo:table .... attributes....>
<xsl:apply-templates/>
</fo:table>
</xsl:template>
or
use an <xsl:attribute-set> so you can set all the attributes for your tables
in the one spot.
<xsl:attribute-set name="tableAtts>
<xsl:attribute name="width">200px</xsl:attribute>
....
....
</xsl:attribute-set>
<fo:table xsl:use-attribute-set="tableAtts">
</fo:table>
BTW this is probably off topic for this list. Use
xsl-list@lists.mulberrytech.com
(http://www.mulberrytech.com/xsl/xsl-list/index.html) for XSL related
questions.
----- Original Message -----
From: "Ryan Howe" <ho...@yahoo.com>
To: <co...@xml.apache.org>
Sent: Thursday, February 14, 2002 7:14 AM
Subject: PDF Table Template?
> Hello,
>
> I am attempting to use the stylesheet included below
> to transform an XML file to PDF using Cocoon 2.0.1. My
> hope to build multiple tables in the PDF file. I have
> created two templates in the stylesheet for opening
> and closing a table.
>
> When running this through Cocoon, I get a
> NullPointerException in Xalan
> (TransformerImpl.run(TransformerImpl.java:3174)). If I
> uncomment the <fo:table> tags in the stylesheet
> comment the call to the two templates, it runs fine
> through Cocoon.
>
> Since I will create about 6 tables in this file, I
> would like to have a template to open the table and
> setup the columns instead of coding the same thing
> several times.
>
> Would anyone have any ideas how to get around this?
>
>
> <?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:output method="xml" version="1.0"
> encoding="UTF-8" indent="yes"/>
> <xsl:template match="/">
> <fo:root
> xmlns:fo="http://www.w3.org/1999/XSL/Format">
> <fo:layout-master-set>
> <fo:simple-page-master master-name="table-page"
> page-height="600pt" page-width="850pt">
> <fo:region-body region-name="table-region"
> margin-left="25pt" margin-top="25pt"
> margin-right="25pt" margin-bottom="25pt"/>
> </fo:simple-page-master>
> <fo:page-sequence-master
> master-name="table-sequence">
> <fo:repeatable-page-master-reference
> master-reference="table-page"/>
> </fo:page-sequence-master>
> </fo:layout-master-set>
>
> <fo:page-sequence
> master-reference="table-sequence">
> <fo:flow flow-name="table-region">
> <fo:block font-size="8pt">
> <!-- <fo:table border-style="solid"
> table-omit-header-at-break="true"> -->
> <xsl:call-template name="OpenPDFTable"/>
> <fo:table-column column-number="1"
> column-width="80pt"/>
> <fo:table-column column-number="2"
> column-width="80pt"/>
> <fo:table-header border-style="solid">
> <fo:table-row keep-with-next="always">
> <fo:table-cell column-number="1"
> number-columns-spanned="2" padding="2pt"
> background-color="#003366">
> <fo:block color="#FFFFFF">Total Mechandise
> Discounts & Adjustments</fo:block>
> </fo:table-cell>
> </fo:table-row>
> </fo:table-header>
> <fo:table-body>
> <fo:table-row>
> <fo:table-cell column-number="1"
> border-style="solid" padding="2pt">
> <fo:block>9099</fo:block>
> </fo:table-cell>
> <fo:table-cell column-number="2"
> border-style="solid" padding="2pt">
> <fo:block>NTB - SOUTH</fo:block>
> </fo:table-cell>
> </fo:table-row>
> </fo:table-body>
> <!-- </fo:table> -->
> <xsl:call-template name="ClosePDFTable"/>
> </fo:block>
> </fo:flow>
> </fo:page-sequence>
> </fo:root>
> </xsl:template>
>
> <xsl:template name="OpenPDFTable">
> <xsl:text disable-output-escaping="yes">
> <fo:table border-style="solid"
> table-omit-header-at-break="true">
> </xsl:text>
> </xsl:template>
>
> <xsl:template name="ClosePDFTable">
> <xsl:text disable-output-escaping="yes">
> </fo:table>
> </xsl:text>
> </xsl:template>
>
> </xsl:stylesheet>
>
>
> __________________________________________________
> Do You Yahoo!?
> Send FREE Valentine eCards with Yahoo! Greetings!
> http://greetings.yahoo.com
>
> ---------------------------------------------------------------------
> Please check that your question has not already been answered in the
> FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
>
> To unsubscribe, e-mail: <co...@xml.apache.org>
> For additional commands, e-mail: <co...@xml.apache.org>
>
>
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>