Dear Cocooners,
Using Cocoon 1.8, I tried to transform a simple xsp data using an xsl
, i was
getting the data transformed three times.
Can anybody tell why??
The test.xsp file is as follows:
<?xml version="1.0" encoding="ISO-8859-1"?>
<?cocoon-process type="xsp"?>
<?cocoon-process type="xslt"?>
<?xml-stylesheet type="text/xsl" href="test.xsl"?>
<xsp:page language="java"
xmlns:xsp="http://www.apache.org/1999/XSP/Core">
<xsp:structure>
<xsp:include>java.lang.*</xsp:include>
</xsp:structure>
<Data>
<xsp:logic>
System.out.println("------------------------------ Hello, I'm
transforming.");
String s1 = "HELLO 1", s2="HELLO 2", s3 ="HELLO 3";
<D1><xsp:expr>s1</xsp:expr></D1>
<D2><xsp:expr>s2</xsp:expr></D2>
<D3><xsp:expr>s3</xsp:expr></D3>
</xsp:logic>
</Data>
</xsp:page>
The test.xsl is as follows:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:template match="Data">
<xsl:processing-instruction name="cocoon-format">
type="text/xslfo"
</xsl:processing-instruction>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master page-master-name="first"
page-height = "10in" page-width = "16.4in"
margin-top = "1cm"
margin-bottom = "0.5cm"
margin-left="0.5cm"
margin-right="0.5cm">
<fo:region-before extent="5cm"/>
<fo:region-body margin-top="2.6cm" margin-bottom="1.25cm"/>
<fo:region-after extent="0.5cm"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence initial-page-number="1">
<fo:sequence-specification>
<fo:sequence-specifier-repeating page-master-first="first"
page-master-repeating="first"
/>
</fo:sequence-specification>
<fo:static-content flow-name="xsl-after">
<fo:block>
<fo:inline-sequence text-align="end">
<fo:block text-align="start" font-size="9pt">
<xsl:value-of select="D1"/>
</fo:block>
</fo:inline-sequence>
</fo:block>
</fo:static-content>
<fo:static-content flow-name="xsl-before">
<fo:table>
<fo:table-column column-width="11cm"/>
<fo:table-body font-family="sans-serif">
<fo:table-row line-height="15pt">
<fo:table-cell>
<fo:block font-size="10pt" color="navy" text-align="start"
line-height="11pt">
<xsl:value-of select="D2"/>
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:static-content>
<fo:flow flow-name="xsl-body">
<fo:table>
<fo:table-column column-width="11cm"/>
<fo:table-body font-family="sans-serif">
<fo:table-row line-height="15pt">
<fo:table-cell>
<fo:block font-size="10pt" color="navy" text-align="start"
line-height="11pt">
<xsl:value-of select="D3"/>
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
</xsl:stylesheet>
Thanks in advance,
Itani
|