<fo:page-sequence master-reference="firstpage"> > > <fo:static-content flow-name="firstheader"> > <fo:block font-size="{fontsize}pt" > font-family="serif" line-height="10pt" color="red"> > <xsl:apply-templates select="html:header"/> -----------------------------------------------
<xsl:apply-templates select="html:header"/> ----------------------------------------------- > </fo:block> > </fo:static-content> > <fo:flow flow-name="xsl-region-body" font-family > ="Times" font-size="12pt"> > <fo:block> > <xsl:apply-templates select > ="html:body-content"/> > </fo:block> > </fo:flow> > </fo:page-sequence> > <fo:page-sequence master-reference="restpages"> > > <fo:static-content flow-name="region-before"> > <fo:block font-size="{fontsize}pt" > font-family="serif" line-height="10pt" color="red"> > <xsl:apply-templates select="html:header"/> ----------------------------------------------- <xsl:apply-templates select="html:header"/> No wonder that you have same content on all pages. You apply same template like above. You have to match different content for different headers on pages. ----------------------------------------------- > </fo:block> > </fo:static-content> > <fo:flow flow-name="xsl-region-body" font-family > ="Times" font-size="12pt"> > <fo:block> > <xsl:apply-templates select > ="html:body-content"/> > </fo:block> > </fo:flow> > </fo:page-sequence> [EMAIL PROTECTED] wrote: > Thanks Sven for the quick reply. I am trying to create a style sheet for > XHMTL Content conversion to PDF. > I am new at xsl and fop , hence finding it little difficult . Would > appreciate if you help me out in finding where I am going wrong . > Thanks and Regards > Rohit > > <!------------------------------------------Here is the code > ---------------------------------------------------> > > <?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" xmlns:html > ="http://www.w3.org/1999/xhtml" version="1.0"> > <xsl:output indent="yes"/> > <!-- ##################################################### --> > <xsl:template match="/"> > <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> > <fo:layout-master-set> > <!-- MAJOR CHANGES START --> > <fo:simple-page-master master-name > ="firstpage" page-height="11in" page-width="8.5in" margin-top="1.25in" > margin-bottom="1.0in" margin-left="1.25in" margin-right="1.25in"> > <fo:region-before region-name > ="firstheader" extent="2.0in" margin-left="0.5in" margin-right="0.5in"/> > <fo:region-after extent="2.0in" > margin-left="0.5in" margin-right="0.5in"/> > <fo:region-body margin-top="2.5cm" > margin-bottom="2.5cm" /> > </fo:simple-page-master> > <fo:simple-page-master master-name > ="restpages" page-height="11in" page-width="8.5in" margin-top="1.25in" > margin-bottom="1.0in" margin-left="1.25in" margin-right="1.25in"> > <fo:region-before extent="2.0in" > margin-left="0.5in" margin-right="0.5in"/> > <fo:region-after extent="2.0in" > margin-left="0.5in" margin-right="0.5in"/> > <fo:region-body margin-top="2.5cm" > margin-bottom="2.5cm" /> > </fo:simple-page-master> > > <!-- MAJOR CHANGES END --> > <fo:page-sequence-master master-name="all"> > <fo:repeatable-page-master-alternatives> > <fo:conditional-page-master-reference page-position > ="first" > master-reference="firstpage"/> > <fo:conditional-page-master-reference page-position > ="rest" > master-reference="restpages"/> > </fo:repeatable-page-master-alternatives> > </fo:page-sequence-master> > </fo:layout-master-set> > > <fo:page-sequence master-reference="firstpage"> > > <fo:static-content flow-name="firstheader"> > <fo:block font-size="{fontsize}pt" > font-family="serif" line-height="10pt" color="red"> > <xsl:apply-templates select > ="html:header"/> > </fo:block> > </fo:static-content> > <fo:flow flow-name="xsl-region-body" font-family > ="Times" font-size="12pt"> > <fo:block> > <xsl:apply-templates select > ="html:body-content"/> > </fo:block> > </fo:flow> > </fo:page-sequence> > <fo:page-sequence master-reference="restpages"> > > <fo:static-content flow-name="region-before"> > <fo:block font-size="{fontsize}pt" > font-family="serif" line-height="10pt" color="red"> > <xsl:apply-templates select > ="html:header"/> > </fo:block> > </fo:static-content> > <fo:flow flow-name="xsl-region-body" font-family > ="Times" font-size="12pt"> > <fo:block> > <xsl:apply-templates select > ="html:body-content"/> > </fo:block> > </fo:flow> > </fo:page-sequence> > > </fo:root> > </xsl:template> > <!-- ##################- title -############################ --> > <xsl:template match="html:title"> > > </xsl:template> > <!-- #####################- body -############################ --> > <!-- MAJOR CHANGES START --> > <xsl:template match="html:body"> > > <!-- The following static content renders the html:header tag > within every pdf page --> > > > <!-- The following static content renders the html:footer tag > within every pdf page --> > <fo:static-content flow-name="xsl-region-after"> > <fo:block text-align="center" font-size="{fontsize}pt" > font-family="serif" line-height="10pt" color="red"> > <xsl:apply-templates select="html:footer"/> > </fo:block> > <!-- This block renders the page number --> > <fo:block text-align="right" font-size="10pt" font-family > ="serif"> > Page <fo:page-number/> > </fo:block> > </fo:static-content> > > > <!-- This flow applies all tenplates available to the body tags > content --> > <!-- Attention: editor content must always be wraped e.g. by a > p tag. plaintext in source view causes a fop error --> > <fo:flow flow-name="xsl-region-body" font-family="Times" > font-size="12pt"> > <xsl:apply-templates select="html:body-content"/> > </fo:flow> > > </xsl:template> > > > <!-- MAJOR CHANGES END --> > <!-- #####################- paragraph -######################## --> > <xsl:template match="html:p"> > <xsl:element name="fo:block"> > <xsl:attribute name > ="space-before.minimum">10pt</xsl:attribute> > <xsl:attribute name > ="space-before.maximum">16pt</xsl:attribute> > <xsl:attribute name > ="space-before.optimum">14pt</xsl:attribute> > <xsl:attribute name > ="space-after.minimum">10pt</xsl:attribute> > <xsl:attribute name > ="space-after.maximum">16pt</xsl:attribute> > <xsl:attribute name > ="space-after.optimum">14pt</xsl:attribute> > <xsl:call-template name="get-align-attr"/> > <xsl:apply-templates/> > </xsl:element> > </xsl:template> > <xsl:template name="get-align-attr"> > <xsl:choose> > <xsl:when test="./@align"> > <xsl:attribute name="text-align"> > <xsl:value-of select="./@align"/> > </xsl:attribute> > </xsl:when> > </xsl:choose> > </xsl:template> > <!-- ##############- basic inline styles -##################### --> > <xsl:template match="html:strong|html:bold"> > <fo:inline font-weight="bold"> > <xsl:apply-templates/> > </fo:inline> > </xsl:template> > <xsl:template match="html:em|html:i"> > <fo:inline font-style="italic"> > <xsl:apply-templates/> > </fo:inline> > </xsl:template> > <!-- #######################- headings -####################### --> > <xsl:template match="html:h1"> > <xsl:element name="fo:block"> > <xsl:attribute name="font-size">24pt</xsl:attribute> > <xsl:call-template name="get-heading-attrs"/> > <xsl:apply-templates/> > </xsl:element> > </xsl:template> > <xsl:template match="html:h2"> > <xsl:element name="fo:block"> > <xsl:attribute name="font-size">20pt</xsl:attribute> > <xsl:call-template name="get-heading-attrs"/> > <xsl:apply-templates/> > </xsl:element> > </xsl:template> > <xsl:template match="html:h3"> > <xsl:element name="fo:block"> > <xsl:attribute name="font-size">18pt</xsl:attribute> > <xsl:call-template name="get-heading-attrs"/> > <xsl:apply-templates/> > </xsl:element> > </xsl:template> > <xsl:template match="html:h4"> > <xsl:element name="fo:block"> > <xsl:attribute name="font-size">16pt</xsl:attribute> > <xsl:call-template name="get-heading-attrs"/> > <xsl:apply-templates/> > </xsl:element> > </xsl:template> > <xsl:template match="html:h5"> > <xsl:element name="fo:block"> > <xsl:attribute name="font-size">14pt</xsl:attribute> > <xsl:call-template name="get-heading-attrs"/> > <xsl:apply-templates/> > </xsl:element> > </xsl:template> > <xsl:template match="html:h6"> > <xsl:element name="fo:block"> > <xsl:attribute name="font-size">12pt</xsl:attribute> > <xsl:call-template name="get-heading-attrs"/> > <xsl:apply-templates/> > </xsl:element> > </xsl:template> > <xsl:template name="get-heading-attrs"> > <xsl:attribute name="font-weight">bold</xsl:attribute> > <xsl:attribute name="space-before">6pt</xsl:attribute> > <xsl:attribute name="space-after">6pt</xsl:attribute> > <xsl:call-template name="get-align-attr"/> > </xsl:template> > <!-- #######################- lists -####################### --> > <xsl:template match="html:ol"> > <fo:list-block start-indent="1em" space-before="6pt" > space-after="6pt" provisional-label-separation="3pt" space-before.optimum > ="6pt"> > <xsl:for-each select="./html:li"> > <fo:list-item> > <fo:list-item-label> > <fo:block> > <xsl:value-of select="position > ()"/>.</fo:block> > </fo:list-item-label> > <fo:list-item-body start-indent="body-start > ()"> > <fo:block> > <xsl:apply-templates/> > </fo:block> > </fo:list-item-body> > </fo:list-item> > </xsl:for-each> > </fo:list-block> > </xsl:template> > <xsl:template match="html:ul"> > <fo:list-block start-indent="1em" space-before="6pt" > space-after="6pt" provisional-label-separation="3pt" space-before.optimum > ="6pt"> > <xsl:for-each select="./html:li"> > <fo:list-item> > <fo:list-item-label> > <fo:block>•</fo:block> > </fo:list-item-label> > <fo:list-item-body start-indent="body-start > ()"> > <fo:block> > <xsl:apply-templates/> > </fo:block> > </fo:list-item-body> > </fo:list-item> > </xsl:for-each> > </fo:list-block> > </xsl:template> > <xsl:template match="html:br"> > <fo:block/> > <xsl:apply-templates/> > </xsl:template> > <!-- #################- font-styles, -size declared through span > -######################## --> > <xsl:template match="html:[EMAIL PROTECTED]'font-size:12pt']|html:span > [EMAIL PROTECTED]'font-size:Normalpt']"> > <fo:block font-size="12pt"> > <xsl:apply-templates/> > </fo:block> > </xsl:template> > <xsl:template match="html:[EMAIL PROTECTED]'font-size:8pt']"> > <fo:inline font-size="8pt"> > <xsl:apply-templates/> > </fo:inline> > </xsl:template> > <xsl:template match="html:[EMAIL PROTECTED]'font-size:10pt']"> > <fo:inline font-size="10pt"> > <xsl:apply-templates/> > </fo:inline> > </xsl:template> > <xsl:template match="html:[EMAIL PROTECTED]'font-size:14pt']"> > <fo:inline font-size="14pt"> > <xsl:apply-templates/> > </fo:inline> > </xsl:template> > <xsl:template match="html:[EMAIL PROTECTED]'font-size:18pt']"> > <fo:inline font-size="18pt"> > <xsl:apply-templates/> > </fo:inline> > </xsl:template> > <xsl:template match="html:[EMAIL PROTECTED]'font-size:24pt']"> > <fo:inline font-size="24pt"> > <xsl:apply-templates/> > </fo:inline> > </xsl:template> > <xsl:template match="html:[EMAIL PROTECTED]'font-size:36pt']"> > <fo:inline font-size="36pt"> > <xsl:apply-templates/> > </fo:inline> > </xsl:template> > <xsl:template match="html:[EMAIL PROTECTED]'font-family: Times; > font-size: > 12pt']|html:[EMAIL PROTECTED]'font-size:Normalpt']"> > <fo:block font-size="12pt" font-family="Times"> > <xsl:apply-templates/> > </fo:block> > </xsl:template> > <xsl:template match="html:[EMAIL PROTECTED]'font-family: Times; > font-size: > 8pt']"> > <fo:inline font-size="8pt" font-family="Times"> > <xsl:apply-templates/> > </fo:inline> > </xsl:template> > <xsl:template match="html:[EMAIL PROTECTED]'font-family: Times; > font-size: > 10pt']"> > <fo:inline font-size="10pt" font-family="Times"> > <xsl:apply-templates/> > </fo:inline> > </xsl:template> > <xsl:template match="html:[EMAIL PROTECTED]'font-family: Times; > font-size: > 14pt']"> > <fo:inline font-size="14pt" font-family="Times"> > <xsl:apply-templates/> > </fo:inline> > </xsl:template> > <xsl:template match="html:[EMAIL PROTECTED]'font-family: Times; > font-size: > 18pt']"> > <fo:inline font-size="18pt" font-family="Times"> > <xsl:apply-templates/> > </fo:inline> > </xsl:template> > <xsl:template match="html:[EMAIL PROTECTED]'font-family: Times; > font-size: > 24pt']"> > <fo:inline font-size="24pt" font-family="Times"> > <xsl:apply-templates/> > </fo:inline> > </xsl:template> > <xsl:template match="html:[EMAIL PROTECTED]'font-family: Times; > font-size: > 36pt']"> > <fo:inline font-size="36pt" font-family="Times"> > <xsl:apply-templates/> > </fo:inline> > </xsl:template> > <xsl:template match="html:[EMAIL PROTECTED]'font-family: Arial; > font-size: > 12pt']|html:[EMAIL PROTECTED]'font-size:Normalpt']"> > <fo:block font-size="12pt" font-family="sans-serif"> > <xsl:apply-templates/> > </fo:block> > </xsl:template> > <xsl:template match="html:[EMAIL PROTECTED]'font-family: Arial; > font-size: > 8pt']"> > <fo:inline font-size="8pt" font-family="sans-serif"> > <xsl:apply-templates/> > </fo:inline> > </xsl:template> > <xsl:template match="html:[EMAIL PROTECTED]'font-family: Arial; > font-size: > 10pt']"> > <fo:inline font-size="10pt" font-family="sans-serif"> > <xsl:apply-templates/> > </fo:inline> > </xsl:template> > <xsl:template match="html:[EMAIL PROTECTED]'font-family: Arial; > font-size: > 14pt']"> > <fo:inline font-size="14pt" font-family="sans-serif"> > <xsl:apply-templates/> > </fo:inline> > </xsl:template> > <xsl:template match="html:[EMAIL PROTECTED]'font-family: Arial; > font-size: > 18pt']"> > <fo:inline font-size="18pt" font-family="sans-serif"> > <xsl:apply-templates/> > </fo:inline> > </xsl:template> > <xsl:template match="html:[EMAIL PROTECTED]'font-family: Arial; > font-size: > 24pt']"> > <fo:inline font-size="24pt" font-family="sans-serif"> > <xsl:apply-templates/> > </fo:inline> > </xsl:template> > <xsl:template match="html:[EMAIL PROTECTED]'font-family: Arial; > font-size: > 36pt']"> > <fo:inline font-size="36pt" font-family="sans-serif"> > <xsl:apply-templates/> > </fo:inline> > </xsl:template> > <xsl:template match="html:[EMAIL PROTECTED]'font-family:Arial']"> > <fo:inline font-family="sans-serif"> > <xsl:apply-templates/> > </fo:inline> > </xsl:template> > <xsl:template match="html:[EMAIL PROTECTED]'font-family:Times']"> > <fo:inline font-family="Times"> > <xsl:apply-templates/> > </fo:inline> > </xsl:template> > <!-- #################- special custom tags -######################## > --> > <xsl:template match="html:pagebreak"> > <fo:block break-before="page" text-align="right"/> > </xsl:template> > <xsl:template match="html:signature"> > <fo:block font-size="12pt" font-family="sans-serif"> > <xsl:apply-templates/> > </fo:block> > </xsl:template> > > <!-- #################- Tables (not supported in sample) > -######################## --> > <xsl:template match="html:table"> > <xsl:if test="@bordercolor"> > <fo:table border-width="[EMAIL PROTECTED]" > border-style > ="solid" border-color="[EMAIL PROTECTED]" background-color="[EMAIL PROTECTED]" > text-align="left" table-layout="fixed"> > <fo:table-column column-width="[EMAIL > PROTECTED]"/> > <fo:table-column column-width="[EMAIL > PROTECTED]"/> > <fo:table-body padding-left="2pt" > padding-right="2pt" padding-top="2pt" padding-bottom="2pt"> > <xsl:apply-templates select="html:tr"/> > </fo:table-body> > </fo:table> > </xsl:if> > <xsl:if test="not(@bordercolor)"> > <fo:table border-width="[EMAIL PROTECTED]" > border-style > ="solid" border-color="white" background-color="[EMAIL PROTECTED]" text-align > ="left" table-layout="fixed"> > <fo:table-column column-width="[EMAIL > PROTECTED]"/> > <fo:table-column column-width="[EMAIL > PROTECTED]"/> > <fo:table-body padding-left="2pt" > padding-right="2pt" padding-top="2pt" padding-bottom="2pt"> > <xsl:apply-templates select="html:tr"/> > </fo:table-body> > </fo:table> > </xsl:if> > > </xsl:template> > > <xsl:template match="html:tr"> > <fo:table-row padding-left="2pt" padding-right="2pt" > padding-top="2pt" padding-bottom="2pt"> > <xsl:apply-templates select="html:th|html:td"/> > </fo:table-row> > </xsl:template> > > <xsl:template match="html:th"> > <fo:table-cell font-weight="bold" text-align="center" > border-width="1px" border-style="solid"> > <fo:block> > <xsl:apply-templates/> > </fo:block> > </fo:table-cell> > </xsl:template> > > <xsl:template match="html:td"> > <fo:table-cell border-width="{../../@border}" > border-style="solid" border-color="lightgrey" > > <fo:block padding-left="{../../@cellpadding}px" > padding-right="{../../@cellpadding}px" padding-top="{../../@cellpadding}px" > padding-bottom="{../../@cellpadding}px"> > <xsl:apply-templates/> > </fo:block> > </fo:table-cell> > </xsl:template> > <!-- #################- IMAGES -######################## --> > <xsl:template match="html:img"> > <fo:block space-after="12pt"> > <fo:external-graphic src="[EMAIL PROTECTED]"> > <xsl:if test="@width"> > <xsl:attribute name="width"> > <xsl:choose> > <xsl:when test="contains > (@width, 'px')"> > <xsl:value-of select > ="@width"/> > </xsl:when> > <xsl:otherwise> > <xsl:value-of select > ="concat(@width, 'px')"/> > </xsl:otherwise> > </xsl:choose> > </xsl:attribute> > </xsl:if> > <xsl:if test="@height"> > <xsl:attribute name="height"> > <xsl:choose> > <xsl:when test="contains > (@height, 'px')"> > <xsl:value-of select > ="@height"/> > </xsl:when> > <xsl:otherwise> > <xsl:value-of select > ="concat(@height, 'px')"/> > </xsl:otherwise> > </xsl:choose> > </xsl:attribute> > </xsl:if> > </fo:external-graphic> > </fo:block> > > </xsl:template> > > </xsl:stylesheet> > > <!----------------------------------- Code Ends Here > ------------------------------------------------------> > > > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]