Zieseniß, Markus wrote:
I also do not understand the wrapper example to count all pages of a
document. Has anybody tested that and can explain how to implement?
I don't understand what's the problem.
1. Write an XML file, let's say foo.xml:
<pages>
<page/> <page/> <page/> <page/> <page/>
</pages>
2. write an XSLT file which transforms this into a FO document.
Let's suppose we generate a page sequence for each page element.
Therefore foo.xsl:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:param name="page-count"/>
<xsl:template match="pages">
<fo:root>
<fo:layout-master-set>
<fo:simple-page-master master-name="simple">
<fo:region-body/>
</fo:simple-page-master>
</fo:layout-master-set>
<xsl:apply-templates/>
</fo:root>
</xsl:template>
<xsl:template match="page">
<fo:page-sequence master-reference="simple">
<fo:flow flow-name="xsl-region-body">
<fo:block>Page <fo:page-number/>
of <xsl:value-of select="$page-count"/></fo:block>
</fo:flow>
</fo:page-sequence>
</xsl:template>
</xsl:stylesheet>
3. Copy&paste the code from the FAQ into a file rendtest.java.
4. Compile the file.
5. Run it
java -classpath .;lib/fop.jar;lib/xml-apis.jar;lib/xercesImpl-2.2.1.jar;
lib/xalan-2.4.1.jar;lib/avalon-framework-cvs-20020806.jar;lib/batik.jar
rendtest foo.xml foo.xsl foo.pdf
The PDF file should contain "Page 1 of 5", "Page 2 of 5" and so on.
How to adapt this to your specific problem, and how to optimize
this is another matter.
J.Pietschmann
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]