Hi, I am unable to generate properly align data in pdf report.so what changes should i make in xsl file for correct alignment od data in pdf? here is my xsl file .Please help for the same.
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" exclude-result-prefixes="fo"> <xsl:output method="xml" version="1.0" omit-xml-declaration="yes" indent="yes"/> <xsl:template match="BODY"> <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> <fo:layout-master-set> <fo:simple-page-master master-name="simpleA4" page-height="624pt" page-width="1010.8pt" margin-top="0cm" margin-bottom="0cm" margin-left="0cm" margin-right="0cm"> <fo:region-body margin-top="0cm" margin-bottom="0cm" margin-left="0in" margin-right="0in"/> <fo:region-after extent="0cm"/> </fo:simple-page-master> </fo:layout-master-set> <fo:page-sequence master-reference="simpleA4"> <fo:flow flow-name="xsl-region-body"> <fo:block font-size="12pt" font-family="monospace" white-space-collapse="false"> <xsl:apply-templates/> </fo:block> </fo:flow> </fo:page-sequence> </fo:root> </xsl:template> <xsl:template match="NLS"> <fo:inline font-size="{...@font-size}pt" font-family="{...@font-family}" white-space-collapse="false"> <xsl:apply-templates/> </fo:inline> </xsl:template> <xsl:template match="B"> <fo:inline font-size="12pt" font-weight="bold" font-family="monospace" white-space-collapse="false"> <xsl:apply-templates/> </fo:inline> </xsl:template> <xsl:template match="I"> <fo:inline font-size="12pt" font-style="italic" font-family="monospace" white-space-collapse="false"> <xsl:apply-templates/> </fo:inline> </xsl:template> <xsl:template match="U"> <fo:inline font-size="12pt" text-decoration="underline" font-family="monospace" white-space-collapse="false"> <xsl:apply-templates/> </fo:inline> </xsl:template> <xsl:template match="table"> <fo:table width="100%" table-layout="fixed"> <xsl:choose> <xsl:when test="@cols"> <xsl:call-template name="build-columns"> <xsl:with-param name="cols" select="concat(@cols, ' ')"/> </xsl:call-template> </xsl:when> <xsl:otherwise> <fo:table-column column-width="200pt"/> </xsl:otherwise> </xsl:choose> <fo:table-body> <xsl:apply-templates select="*"/> </fo:table-body> </fo:table> </xsl:template> <xsl:template name="build-columns"> <xsl:param name="cols"/> <xsl:if test="string-length(normalize-space($cols))"> <xsl:variable name="next-col"> <xsl:value-of select="substring-before($cols, ' ')"/> </xsl:variable> <xsl:variable name="remaining-cols"> <xsl:value-of select="substring-after($cols, ' ')"/> </xsl:variable> <xsl:choose> <xsl:when test="contains($next-col, 'pt')"> <fo:table-column column-width="{$next-col}"/> </xsl:when> <xsl:when test="number($next-col) > 0"> <fo:table-column column-width="{concat($next-col, 'pt')}"/> </xsl:when> <xsl:otherwise> <fo:table-column column-width="50pt"/> </xsl:otherwise> </xsl:choose> <xsl:call-template name="build-columns"> <xsl:with-param name="cols" select="concat($remaining-cols, ' ')"/> </xsl:call-template> </xsl:if> </xsl:template> <xsl:template match="tr"> <fo:table-row height="{...@height}"> <xsl:if test="@valign"> <xsl:attribute name="display-align"> <xsl:value-of select="@valign"/> </xsl:attribute> </xsl:if> <xsl:if test="@valign"> <xsl:attribute name="display-align"> <xsl:value-of select="@valign"/> </xsl:attribute> </xsl:if> <xsl:apply-templates select="*|text()"/> </fo:table-row> </xsl:template> <xsl:template match="td"> <fo:table-cell padding-start="0pt" padding-end="0pt" padding-before="0pt" padding-after="0pt"> <xsl:if test="@colspan"> <xsl:attribute name="number-columns-spanned"> <xsl:value-of select="@colspan"/> </xsl:attribute> </xsl:if> <xsl:if test="@rowspan"> <xsl:attribute name="number-rows-spanned"> <xsl:value-of select="@rowspan"/> </xsl:attribute> </xsl:if> <xsl:if test="@border='1' or ancestor::t...@border='1'] or ancestor::the...@border='1'] or ancestor::tab...@border='1']"> <xsl:attribute name="border-style"> <xsl:text>solid</xsl:text> </xsl:attribute> <xsl:attribute name="border-color"> <xsl:text>black</xsl:text> </xsl:attribute> <xsl:attribute name="border-width"> <xsl:text>1pt</xsl:text> </xsl:attribute> </xsl:if> <xsl:variable name="align"> <xsl:choose> <xsl:when test="@align"> <xsl:choose> <xsl:when test="@align='center'"> <xsl:text>center</xsl:text> </xsl:when> <xsl:when test="@align='right'"> <xsl:text>end</xsl:text> </xsl:when> <xsl:when test="@align='justify'"> <xsl:text>justify</xsl:text> </xsl:when> <xsl:otherwise> <xsl:text>start</xsl:text> </xsl:otherwise> </xsl:choose> </xsl:when> <xsl:when test="ancestor::t...@align]"> <xsl:choose> <xsl:when test="ancestor::tr/@align='center'"> <xsl:text>center</xsl:text> </xsl:when> <xsl:when test="ancestor::tr/@align='right'"> <xsl:text>end</xsl:text> </xsl:when> <xsl:when test="ancestor::tr/@align='justify'"> <xsl:text>justify</xsl:text> </xsl:when> <xsl:otherwise> <xsl:text>start</xsl:text> </xsl:otherwise> </xsl:choose> </xsl:when> <xsl:when test="ancestor::thead"> <xsl:text>center</xsl:text> </xsl:when> <xsl:when test="ancestor::tab...@align]"> <xsl:choose> <xsl:when test="ancestor::table/@align='center'"> <xsl:text>center</xsl:text> </xsl:when> <xsl:when test="ancestor::table/@align='right'"> <xsl:text>end</xsl:text> </xsl:when> <xsl:when test="ancestor::table/@align='justify'"> <xsl:text>justify</xsl:text> </xsl:when> <xsl:otherwise> <xsl:text>start</xsl:text> </xsl:otherwise> </xsl:choose> </xsl:when> <xsl:otherwise> <xsl:text>start</xsl:text> </xsl:otherwise> </xsl:choose> </xsl:variable> <fo:block text-align="{$align}"> <xsl:apply-templates select="*|text()"/> </fo:block> </fo:table-cell> </xsl:template> <xsl:template match="font"> <fo:inline font-size="12pt" font-family="monospace" color="{...@color}" white-space-collapse="false"> <xsl:apply-templates/> </fo:inline> </xsl:template> <xsl:template match="img"> <xsl:choose> <xsl:when test="@width and @height"> <fo:inline> <fo:external-graphic width="{...@width}pt" height="{...@height}pt" src="{...@src}"/> </fo:inline> </xsl:when> <xsl:when test="@width"> <fo:inline> <fo:external-graphic width="{...@width}pt" src="{...@src}"/> </fo:inline> </xsl:when> <xsl:when test="@height"> <fo:inline> <fo:external-graphic height="{...@height}pt" src="{...@src}"/> </fo:inline> </xsl:when> <xsl:otherwise> <fo:inline> <fo:external-graphic src="{...@src}"/> </fo:inline> </xsl:otherwise> </xsl:choose> </xsl:template> </xsl:stylesheet> This e-Mail may contain proprietary and confidential information and is sent for the intended recipient(s) only. If by an addressing or transmission error this mail has been misdirected to you, you are requested to delete this mail immediately. You are also hereby notified that any use, any form of reproduction, dissemination, copying, disclosure, modification, distribution and/or publication of this e-mail message, contents or its attachment other than by its intended recipient/s is strictly prohibited. Visit us at http://www.polaris.co.in --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
