PDF from XSL FO smart service

Hi Guys ,

 I'm trying to generate a pdf of a dynamic table data and other content.   XML file is 

<?xml version="1.0" encoding="UTF-8"?> 
<?xml-stylesheet type="text/xsl "href="_xslStyleSheet.xslt" ?> 
<student> 
<s> 
<name> Divyank Singh Sikarwar </name> 
<branch> CSE</branch> 
<age>18</age> 
<city> Agra </city> 
</s> 
<s> 
<name> Aniket Chauhan </name> 
<branch> CSE</branch> 
<age> 20</age> 
<city> Shahjahanpur </city> 
</s> 
<s> 
<name> Simran Agarwal</name> 
<branch> CSE</branch> 
<age> 23</age> 
<city> Buland Shar</city> 
</s> 
<s> 
<name> Abhay Chauhan</name> 
<branch> CSE</branch> 
<age> 17</age> 
<city> Shahjahanpur</city> 
</s> 
<s> 
<name> Himanshu Bhatia</name> 
<branch> IT</branch> 
<age> 25</age> 
<city> Indore</city> 
</s> 
</student> 

   ,  XSL- FO is  

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" version="1.0">
   <xsl:output encoding="UTF-8" indent="yes" method="xml" />
   <xsl:template match="/">
      <fo:root language="IT">
         <fo:layout-master-set>
            <fo:simple-page-master master-name="A4-portrail" page-height="297mm" page-width="210mm" margin-top="5mm" margin-bottom="5mm" margin-left="5mm" margin-right="5mm">
               <fo:region-body margin-top="25mm" margin-bottom="20mm" />
            </fo:simple-page-master>
         </fo:layout-master-set>
         <fo:page-sequence master-reference="A4-portrail">
            <fo:flow flow-name="xsl-region-body" border-collapse="collapse" reference-orientation="0">
               <fo:block>Sample XSL FO</fo:block>
               <fo:table-and-caption>
                  <fo:table table-layout="fixed" width="100%" font-size="10pt" border-color="black" border-width="0.35mm" border-style="solid" text-align="center" display-align="center" space-after="5mm">
                     <fo:table-column />
                     <fo:table-header>
                        <fo:table-row>
                           <fo:table-cell>
                              <fo:block font-weight="bold">Names</fo:block>
                           </fo:table-cell>
                        </fo:table-row>
                     </fo:table-header>
                     <fo:table-body font-size="95%">
                        <xsl:for-each select="student/s">
                           <fo:table-row>
                              <fo:table-cell>
                                 <fo:block>
                                    <xsl:value-of select="name" />
                                 </fo:block>
                              </fo:table-cell>
                           </fo:table-row>
                        </xsl:for-each>
                     </fo:table-body>
                  </fo:table>
               </fo:table-and-caption>
            </fo:flow>
         </fo:page-sequence>
      </fo:root>
   </xsl:template>
</xsl:stylesheet>
(saved as _xslStyleSheet.xsl ) and the result pdf isPDF .

  Smart service is not able to generate table in the PDF document. In many ways a gave a try but no success,may be i'm missing something in XSL .. Can anyone suggest/correct/advice to achieve the desired result?

Thanks in advance...!

  Discussion posts and replies are publicly visible

Parents
  • <fo:block>
    	<fo:table width="100%" border-style="outset" border-width="0.15mm">
    		<fo:table-column column-width="proportional-column-width(50)"/>
            <fo:table-column column-width="proportional-column-width(50)"/>
            <fo:table-header>
    			<fo:table-row>
    				<fo:table-cell border-style="groove" border-width="0.15mm" display-align="center" background-color="#0071BC">
                        <fo:block font-weight="bold" font-size="8pt" font-family="sans-serif" text-align="center" color="white">
                            <xsl:text>Physical Address</xsl:text>
                        </fo:block>
                    </fo:table-cell>
                    <fo:table-cell border-style="groove" border-width="0.15mm" display-align="center" background-color="#0071BC">
                        <fo:block font-weight="bold" font-size="8pt" font-family="sans-serif" text-align="center" color="white">
                            <xsl:text>Mailing Address</xsl:text>
                        </fo:block>
                    </fo:table-cell>
    			</fo:table-row>
    		</fo:table-header>
    		<fo:table-body>
    			<fo:table-row>
    				<fo:table-cell border-style="groove" border-width="0.15mm" display-align="center">
                        <fo:block  font-size="8pt" font-family="sans-serif" text-align="center">
                            <fo:block>
    						<xsl:value-of select="/project/address1/addressLine1"/>
    						<xsl:text> </xsl:text>
    						<xsl:value-of select="/project/address1/addressLine2"/>,
    						<xsl:if test="project/address1/addressLine3 != ''">
    						 <xsl:value-of select="/project/address1/addressLine3"/>
    						</xsl:if>
    					</fo:block>
    					<fo:block>
    						<xsl:value-of select="/project/address1/city"/>, 
    						<xsl:value-of select="/project/address1/state"/>
    						<xsl:text> </xsl:text>
    						<xsl:value-of select="/project/address1/zip"/>
    						<xsl:if test="project/address1/zipplus4 != ''">
    							- <xsl:value-of select="/project/address1/zipplus4"/>
    						</xsl:if>
    					</fo:block>
                        </fo:block>
                    </fo:table-cell>
                    <fo:table-cell border-style="groove" border-width="0.15mm" display-align="center">
                        <fo:block font-size="8pt" font-family="sans-serif" text-align="center">
    						<xsl:if test="/project/address2/addressLine1 = ''">
    							<xsl:text>Not Applicable</xsl:text>
    						</xsl:if>
    						<xsl:if test="/project/address2/addressLine1 != ''">
    							<fo:block>
    								<xsl:value-of select="/project/address2/addressLine1"/>
                                    <xsl:text> </xsl:text> 
    								<xsl:value-of select="/project/address2/addressLine2"/>,
    								<xsl:if test="project/address2/addressLine3 != ''">
    								  <xsl:value-of select="/project/address2/addressLine3"/>
    								</xsl:if> 
    							</fo:block>
    							<fo:block>
    								<xsl:value-of select="/project/address2/city"/>, 
    								<xsl:value-of select="/project/address2/state"/>
    								<xsl:text> </xsl:text>
    								<xsl:value-of select="/project/address2/zip"/>
    								<xsl:if test="project/address2/zipplus4 != ''">
    									- <xsl:value-of select="/project/address2/zipplus4"/>
    								</xsl:if>
    							</fo:block>
    						</xsl:if>
                        </fo:block>
                    </fo:table-cell>
    			</fo:table-row>
    		</fo:table-body>
    	</fo:table>
    </fo:block>

    Here is a sample table code which should work

Reply
  • <fo:block>
    	<fo:table width="100%" border-style="outset" border-width="0.15mm">
    		<fo:table-column column-width="proportional-column-width(50)"/>
            <fo:table-column column-width="proportional-column-width(50)"/>
            <fo:table-header>
    			<fo:table-row>
    				<fo:table-cell border-style="groove" border-width="0.15mm" display-align="center" background-color="#0071BC">
                        <fo:block font-weight="bold" font-size="8pt" font-family="sans-serif" text-align="center" color="white">
                            <xsl:text>Physical Address</xsl:text>
                        </fo:block>
                    </fo:table-cell>
                    <fo:table-cell border-style="groove" border-width="0.15mm" display-align="center" background-color="#0071BC">
                        <fo:block font-weight="bold" font-size="8pt" font-family="sans-serif" text-align="center" color="white">
                            <xsl:text>Mailing Address</xsl:text>
                        </fo:block>
                    </fo:table-cell>
    			</fo:table-row>
    		</fo:table-header>
    		<fo:table-body>
    			<fo:table-row>
    				<fo:table-cell border-style="groove" border-width="0.15mm" display-align="center">
                        <fo:block  font-size="8pt" font-family="sans-serif" text-align="center">
                            <fo:block>
    						<xsl:value-of select="/project/address1/addressLine1"/>
    						<xsl:text> </xsl:text>
    						<xsl:value-of select="/project/address1/addressLine2"/>,
    						<xsl:if test="project/address1/addressLine3 != ''">
    						 <xsl:value-of select="/project/address1/addressLine3"/>
    						</xsl:if>
    					</fo:block>
    					<fo:block>
    						<xsl:value-of select="/project/address1/city"/>, 
    						<xsl:value-of select="/project/address1/state"/>
    						<xsl:text> </xsl:text>
    						<xsl:value-of select="/project/address1/zip"/>
    						<xsl:if test="project/address1/zipplus4 != ''">
    							- <xsl:value-of select="/project/address1/zipplus4"/>
    						</xsl:if>
    					</fo:block>
                        </fo:block>
                    </fo:table-cell>
                    <fo:table-cell border-style="groove" border-width="0.15mm" display-align="center">
                        <fo:block font-size="8pt" font-family="sans-serif" text-align="center">
    						<xsl:if test="/project/address2/addressLine1 = ''">
    							<xsl:text>Not Applicable</xsl:text>
    						</xsl:if>
    						<xsl:if test="/project/address2/addressLine1 != ''">
    							<fo:block>
    								<xsl:value-of select="/project/address2/addressLine1"/>
                                    <xsl:text> </xsl:text> 
    								<xsl:value-of select="/project/address2/addressLine2"/>,
    								<xsl:if test="project/address2/addressLine3 != ''">
    								  <xsl:value-of select="/project/address2/addressLine3"/>
    								</xsl:if> 
    							</fo:block>
    							<fo:block>
    								<xsl:value-of select="/project/address2/city"/>, 
    								<xsl:value-of select="/project/address2/state"/>
    								<xsl:text> </xsl:text>
    								<xsl:value-of select="/project/address2/zip"/>
    								<xsl:if test="project/address2/zipplus4 != ''">
    									- <xsl:value-of select="/project/address2/zipplus4"/>
    								</xsl:if>
    							</fo:block>
    						</xsl:if>
                        </fo:block>
                    </fo:table-cell>
    			</fo:table-row>
    		</fo:table-body>
    	</fo:table>
    </fo:block>

    Here is a sample table code which should work

Children
No Data