You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by tc...@apache.org on 2003/05/22 18:53:04 UTC
cvs commit: cocoon-2.1/src/blocks/itext/samples sitemap.xmap
tcurdt 2003/05/22 09:53:04
Added: src/blocks/itext/conf itext.xsamples
src/blocks/itext/samples/cache-test xsp-sample-to-itext.xsl
src/blocks/itext/samples/misc minimal.itext.xml samples.xml
src/blocks/itext/samples sitemap.xmap
Log:
still needs some work but better than nothing
Revision Changes Path
1.1 cocoon-2.1/src/blocks/itext/conf/itext.xsamples
Index: itext.xsamples
===================================================================
<?xml version="1.0"?>
<xsamples xpath="/samples" unless="group[@name='iText']">
<group name="iText">
<sample name="iText PDF serializer" href="itext/">
Examples of PDF document generation.
</sample>
</group>
</xsamples>
1.1 cocoon-2.1/src/blocks/itext/samples/cache-test/xsp-sample-to-itext.xsl
Index: xsp-sample-to-itext.xsl
===================================================================
<?xml version="1.0" encoding="utf-8"?>
<!--
Convert the output of the XSP caching sample to iText,
in order to test caching of the whole pipeline, up to PDF
@author tcurdt@apache.org
-->
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>
<xsl:param name="pages" select="'10'"/>
<xsl:template match="/">
<itext creationdate="Fri May 23 9:30:00 CEST 2003" producer="tcurdt@cocoon.org">
<xsl:call-template name="repeatPages">
<xsl:with-param name="nPages" select="$pages"/>
</xsl:call-template>
<paragraph font="unknown" size="12.0" align="Default">
End of test document
</paragraph>
</itext>
</xsl:template>
<!-- generate a lot of pages to make FOP generation slower -->
<xsl:template name="repeatPages">
<xsl:param name="nPages"/>
<paragraph font="unknown" size="12.0" align="Default">
<newpage/>
Dummy page, used to slow down FOP generation to test caching...
<xsl:value-of select="$nPages"/> pages to go.
</paragraph>
<xsl:if test="$nPages > 1">
<xsl:call-template name="repeatPages">
<xsl:with-param name="nPages" select="$nPages - 1"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<!-- minimal HTML scraping of input -->
<xsl:template match="*[starts-with(name(),'h')]|p">
<paragraph font="unknown" size="12.0" align="Default">
<xsl:apply-templates/>
</paragraph>
</xsl:template>
<!-- minimal HTML scraping of input -->
<xsl:template match="br">
<newline/>
</xsl:template>
<!-- minimal HTML scraping of input -->
<xsl:template match="b">
<chunk size="20.0" fontstyle="bold" red="255" green="0" blue="0">
<xsl:apply-templates/>
</chunk>
</xsl:template>
</xsl:stylesheet>
1.1 cocoon-2.1/src/blocks/itext/samples/misc/minimal.itext.xml
Index: minimal.itext.xml
===================================================================
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE ITEXT SYSTEM "http://www.lowagie.com/iText/itext.dtd">
<itext creationdate="Fri May 23 9:30:00 CEST 2003" producer="tcurdt@cocoon.org">
<paragraph font="unknown" size="18.0" align="Center">
Congratulations!
</paragraph>
<paragraph font="unknown" size="12.0" align="Default">
If you see this in a PDF document, it means that Cocoon and iText
were able to generate it from the minimal.itext.xml example document.
</paragraph>
</itext>
1.1 cocoon-2.1/src/blocks/itext/samples/misc/samples.xml
Index: samples.xml
===================================================================
<?xml version="1.0" encoding="iso-8859-1"?>
<samples xmlns:xlink="http://www.w3.org/1999/xlink">
<group name="Main examples page.">
<sample name="Back" href="..">to Cocoon examples main page</sample>
</group>
<group name="Simple iText examples">
<sample name="Hello, PDF world!" href="hello.pdf">
The well-known hello.xml document rendered as PDF.
</sample>
<sample name="iText document" href="misc/minimal.itext.xml">
Source document used by FOP in the next example.
</sample>
<sample name="PDF output" href="misc/minimal.pdf">
PDF version of the above document
</sample>
</group>
<group name="XSP + iText caching test">
<sample name="PDF with pageKey=ONE, 250 pages" href="cache-test-250.pdf?pageKey=ONE&other=xyz&validity=60">
Needs the serverpages generator to generate input, see generated document or sitemap for info.
</sample>
<sample name="PDF with pageKey=TWO, 125 pages" href="cache-test-125.pdf?pageKey=TWO&validity=45">
Uses a different pageKey value to check that both are cached separately.
</sample>
</group>
<group name="Resources">
<sample name="iText web site" href="http://www.lowagie.com/iText/">
iText reference information
</sample>
</group>
</samples>
1.1 cocoon-2.1/src/blocks/itext/samples/sitemap.xmap
Index: sitemap.xmap
===================================================================
<?xml version="1.0"?>
<!--
iText block samples sitemap
-->
<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
<map:pipelines>
<map:pipeline type="caching">
<map:match pattern="">
<map:redirect-to uri="welcome"/>
</map:match>
<!-- list of samples -->
<map:match pattern="welcome">
<map:generate src="misc/samples.xml"/>
<map:transform src="context://samples/common/style/xsl/html/simple-samples2html.xsl">
<map:parameter name="contextPath" value="{request:contextPath}"/>
</map:transform>
<map:serialize/>
</map:match>
<!-- hello world -->
<map:match pattern="hello.pdf">
<map:generate src="context://samples/hello-world/content/hello.xml"/>
<map:transform src="context://samples/hello-world/style/xsl/page2itext.xsl"/>
<map:serialize type="itext2pdf">
<map:parameter name="page-size" value="A4"/>
<map:parameter name="page-orientation" value="portrait"/>
</map:serialize>
</map:match>
<!-- iText document access -->
<map:match pattern="**/*.itext.xml">
<map:generate src="{1}/{2}.itext.xml"/>
<map:serialize type="xml"/>
</map:match>
<!-- PDF conversion -->
<map:match pattern="**/*.pdf">
<map:generate src="cocoon:/{1}/{2}.itext.xml"/>
<map:serialize type="itext2pdf"/>
</map:match>
<!-- reuse the XSP caching example for our caching test -->
<map:match pattern="cache-test-*.pdf">
<!-- note that caching didn't work when accessing the XSP using the cocoon:/ protocol -->
<map:generate src="../xsp/xsp/cacheable.xsp" type="serverpages"/>
<map:transform src="cache-test/xsp-sample-to-itext.xsl">
<map:parameter name="pages" value="{1}"/>
</map:transform>
<map:serialize type="itext2pdf"/>
</map:match>
</map:pipeline>
</map:pipelines>
</map:sitemap>