You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Muthu KR <mu...@gmail.com> on 2010/08/09 07:28:48 UTC
Different color in FOP need help
Hi All,
I am working on FOP. I am trying to convert the xml file to pdf
using FOP and I have achieved it. But I have One doubt in it. I think you
people can help me out. I need to put different colors for true and false.
But i dont know how to do it. I have attached my stylesheet with this mail.
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" indent="yes"/>
<xsl:template match="CompleteReport">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master page-height="297mm" page-width="210mm"
margin="5mm 25mm 5mm 25mm" master-name="PageMaster">
<fo:region-body margin="20mm 0mm 20mm 0mm"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="PageMaster">
<fo:flow flow-name="xsl-region-body" >
<fo:block>
<xsl:apply-templates select="Roles|RoleServices"/>
<xsl:apply-templates select="name"/>
</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
<xsl:template match="Roles|RoleServices">
<fo:block text-align="left">
<xsl:attribute name="space-before">1.3em</xsl:attribute>
<fo:inline font-weight="bold" padding="1.5em" text-align="left">
<xsl:value-of select="local-name()"/>
</fo:inline>
</fo:block>
<fo:list-block font-size="8pt">
<xsl:attribute name="space-before">1.3em</xsl:attribute>
<fo:list-item>
<fo:list-item-label>
<fo:block text-align="left">
<xsl:value-of select="@name"/>
</fo:block>
</fo:list-item-label>
<fo:list-item-body start-indent="body-start( )">
<fo:block text-align="right">
<xsl:apply-templates select="*|text()"/>
</fo:block>
</fo:list-item-body>
</fo:list-item>
</fo:list-block>
</xsl:template>
<xsl:template match="Roles/Roles|RoleServices/RoleServices">
<fo:list-block font-size="8pt">
<xsl:attribute name="space-before">1.3em</xsl:attribute>
<fo:list-item>
<fo:list-item-label>
<fo:block text-align="left">
<xsl:value-of select="@name"/>
</fo:block>
</fo:list-item-label>
<fo:list-item-body start-indent="body-start( )">
<fo:block text-align="right">
<xsl:apply-templates select="*|text()"/> -------In this
place the text will be displayed Here I need to show True means in one color
False means another color.
</fo:block>
</fo:list-item-body>
</fo:list-item>
</fo:list-block>
</xsl:template>
</xsl:stylesheet >
Can any one help me out??
Regards
Muthu
AW: Different color in FOP need help
Posted by Georg Datterl <ge...@geneon.de>.
Hi Muthu,
If you want a colored background, the attribute is background-color. For a colored foreground, the attribute is color. Red color, for example: color="rgb(255, 0, 0)"
Mit freundlichen Grüßen
Georg Datterl
------ Kontakt ------
Georg Datterl
Geneon media solutions gmbh
Gutenstetter Straße 8a
90449 Nürnberg
HRB Nürnberg: 17193
Geschäftsführer: Yong-Harry Steiert
Tel.: 0911/36 78 88 - 26
Fax: 0911/36 78 88 - 20
www.geneon.de<http://www.geneon.de>
Weitere Mitglieder der Willmy MediaGroup:
IRS Integrated Realization Services GmbH: www.irs-nbg.de<http://www.irs-nbg.de>
Willmy PrintMedia GmbH: www.willmy.de<http://www.willmy.de>
Willmy Consult & Content GmbH: www.willmycc.de<http://www.willmycc.de>
Von: Muthu KR [mailto:muthiah85@gmail.com]
Gesendet: Montag, 9. August 2010 07:29
An: fop-users@xmlgraphics.apache.org
Betreff: Different color in FOP need help
Hi All,
I am working on FOP. I am trying to convert the xml file to pdf using FOP and I have achieved it. But I have One doubt in it. I think you people can help me out. I need to put different colors for true and false. But i dont know how to do it. I have attached my stylesheet with this mail.
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" indent="yes"/>
<xsl:template match="CompleteReport">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master page-height="297mm" page-width="210mm"
margin="5mm 25mm 5mm 25mm" master-name="PageMaster">
<fo:region-body margin="20mm 0mm 20mm 0mm"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="PageMaster">
<fo:flow flow-name="xsl-region-body" >
<fo:block>
<xsl:apply-templates select="Roles|RoleServices"/>
<xsl:apply-templates select="name"/>
</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
<xsl:template match="Roles|RoleServices">
<fo:block text-align="left">
<xsl:attribute name="space-before">1.3em</xsl:attribute>
<fo:inline font-weight="bold" padding="1.5em" text-align="left">
<xsl:value-of select="local-name()"/>
</fo:inline>
</fo:block>
<fo:list-block font-size="8pt">
<xsl:attribute name="space-before">1.3em</xsl:attribute>
<fo:list-item>
<fo:list-item-label>
<fo:block text-align="left">
<xsl:value-of select="@name"/>
</fo:block>
</fo:list-item-label>
<fo:list-item-body start-indent="body-start( )">
<fo:block text-align="right">
<xsl:apply-templates select="*|text()"/>
</fo:block>
</fo:list-item-body>
</fo:list-item>
</fo:list-block>
</xsl:template>
<xsl:template match="Roles/Roles|RoleServices/RoleServices">
<fo:list-block font-size="8pt">
<xsl:attribute name="space-before">1.3em</xsl:attribute>
<fo:list-item>
<fo:list-item-label>
<fo:block text-align="left">
<xsl:value-of select="@name"/>
</fo:block>
</fo:list-item-label>
<fo:list-item-body start-indent="body-start( )">
<fo:block text-align="right">
<xsl:apply-templates select="*|text()"/> -------In this place the text will be displayed Here I need to show True means in one color False means another color.
</fo:block>
</fo:list-item-body>
</fo:list-item>
</fo:list-block>
</xsl:template>
</xsl:stylesheet >
Can any one help me out??
Regards
Muthu