cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mathews, Silvy (HQP)" <Silvy.Math...@rhi.com>
Subject ESQL Doubt
Date Sat, 13 Apr 2002 00:16:43 GMT
Friends,
Could some one tell me how to get the table output format for the values
which I get from the database. The source is below:

Thanks in advance
S Mathews


----------------------------------------------------------------------------
-------------------------------

Format Required:

EMPID	EMPNAME
1      aaaaa
2      sdfgsdfg
3      adfadsf






*************  	ESQL FILE  *****************************

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsp:page
          language="java"
          xmlns:xsp="http://apache.org/xsp"
	  xmlns:esql="http://apache.org/cocoon/SQL/v2"
>

  <page>

   <title>This pages are generated dynamically from Table </title>

   <content>

   <esql:connection>
     <esql:pool>AdminConnectionPool</esql:pool>
     <esql:execute-query>
       <esql:query>select empid,empname from employee  
       </esql:query>
       <esql:results>
         <esql:row-results>
         <silvy>
           <para><esql:get-string column="empid"/></para>
           <col2><esql:get-string column="empname"/></col2>
         </silvy>  
         </esql:row-results>
       </esql:results>
     </esql:execute-query>
   </esql:connection>
   </content>
  </page>
</xsp:page>


************  XSL Document *******************************


<?xml version="1.0"?>
<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="/">
    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
       <fo:layout-master-set>
        <fo:simple-page-master 	master-name="one"
        			margin-left="100pt"
        			margin-right="100pt">
           <fo:region-body 	margin-top="50pt"
           			margin-bottom="50pt"/> 
        </fo:simple-page-master>
    </fo:layout-master-set>

    <fo:layout-master-set>
        <fo:simple-page-master 	master-name="page"
                     		page-height="29.7cm" 
                     		page-width="21cm"
                     		margin-top="1cm" 
                     		margin-bottom="2cm" 
                     		margin-left="2.5cm" 
                     		margin-right="2.5cm">
          	<fo:region-before extent="3cm"/>
          	<fo:region-body margin-top="3cm"/>
          	<fo:region-after extent="1.5cm"/>
        </fo:simple-page-master>
   
        <fo:page-sequence-master master-name="all">
            <fo:repeatable-page-master-alternatives>
                <fo:conditional-page-master-reference
master-reference="page" page-position="first"/>
            </fo:repeatable-page-master-alternatives>
        </fo:page-sequence-master>
</fo:layout-master-set>
       
   
<fo:page-sequence master-reference="all">
         <fo:static-content flow-name="xsl-region-after">
   	     <fo:block text-align="center" 
   	               font-size="10pt" 
   		       font-family="serif" 
   		       line-height="14pt">page <fo:page-number/></fo:block>
         </fo:static-content> 
   
         <fo:flow flow-name="xsl-region-body">		
         
                 <fo:table>
	                 <fo:table-column column-width="3cm"/>
	                 <fo:table-column column-width="5cm"/>
	                 <fo:table-column column-width="5cm"/>
	                    <fo:table-body font-size="10pt"
line-height="16pt"  font-family="sans-serif">
	                       <xsl:for-each select="page/content">
	                       <fo:table-row>   
				    <fo:table-cell>
				         <fo:block  text-align="start" >
				     	    <fo:basic-link color="black">
				     	            <xsl:attribute
name="internal-destination">
				     	               <xsl:value-of
select="translate(.,' ),-.(','____')"/>
				     	            </xsl:attribute>
				     	            <xsl:value-of
select="."/>
				     	     </fo:basic-link> 
				     	 </fo:block>
				     </fo:table-cell> 
				</fo:table-row>         
				</xsl:for-each>
			 </fo:table-body>
	         </fo:table>
           </fo:flow>
     </fo:page-sequence>
  </fo:root>
 </xsl:template>
 </xsl:stylesheet>
 
 
 
 *******************SITEMAP.XMAP *******************
 
  <map:pipeline>
   <map:match pattern="mjsilvy/*">
       <map:generate type="serverpages" src="mjsilvy/{1}.xsp"/>
           <map:transform src="mjsilvy/silvys_fo.xsl">
           <map:parameter name="view-source" value="mjsilvy/{1}.xsp"/>
       </map:transform>
       <map:serialize type="fo2pdf"/>
    </map:match>
</map:pipeline>



Mime
View raw message