How do I fix the issue with tables in xsl-fo, please help...
Posted
by atrueguy
on Stack Overflow
See other posts from Stack Overflow
or by atrueguy
Published on 2010-05-13T06:21:57Z
Indexed on
2010/05/13
6:24 UTC
Read the original article
Hit count: 346
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml:stylesheet type="text/xsl" href="currency.xslt"?>
<currencylist>
<title>Currencies By Country</title>
<countries>
<country>Australia</country>
<currency>Australian Dollar</currency>
</countries>
<countries>
<country>Austria</country>
<currency>Schilling</currency>
</countries>
<countries>
<country>Belgium</country>
<currency>Belgium Franc</currency>
</countries>
<countries>
<country>Canada</country>
<currency>Canadian Dollar</currency>
</countries>
<countries>
<country>England</country>
<currency>Pound</currency>
</countries>
<countries>
<country>Fiji</country>
<currency>Fijian Dollar</currency>
</countries>
<countries>
<country>France</country>
<currency>Franc</currency>
</countries>
<countries>
<country>Germany</country>
<currency>DMark</currency>
</countries>
<countries>
<country>Hong Kong</country>
<currency>Hong Kong Dollar</currency>
</countries>
<countries>
<country>Italy</country>
<currency>Lira</currency>
</countries>
<countries>
<country>Japan</country>
<currency>Yen</currency>
</countries>
<countries>
<country>Netherlands</country>
<currency>Guilder</currency>
</countries>
<countries>
<country>Switzerland</country>
<currency>SFranc</currency>
</countries>
<countries>
<country>USA</country>
<currency>Dollar</currency>
</countries>
</currencylist>
This is my exact xml code. I have written a xsl-fo for this xml file and I am failing to produce the output in a table. please check and help me in this. ASAP.
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master master-name="Letter" page-height="11in" page-width="8.5in">
<fo:region-body region-name="only_region" margin="1in" background-color="#CCCCCC"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="Letter">
<fo:flow flow-name="only_region">
<fo:block text-align="left"><xsl:call-template name="show_title"/></fo:block>
<fo:table-and-caption>
<fo:table>
<fo:table-column column-width="25mm"/>
<fo:table-column column-width="25mm"/>
<fo:table-column column-width="25mm"/>
<fo:table-header>
<fo:table-row>
<fo:table-cell>
<fo:block font-weight="bold">SI No</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block font-weight="bold">Country</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block font-weight="bold">Currency</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-header>
<fo:table-body>
<fo:table-row>
<fo:table-cell>
<fo:block><xsl:call-template name="select_position"/></fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block><xsl:call-template name="select_country"/></fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block><xsl:call-template name="select_currency"/></fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:table-and-caption>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
<xsl:template name="show_title" match="currencylist">
<h2><xsl:value-of select="currencylist/title"/></h2>
</xsl:template>
<xsl:template name="select_position" match="currencylist">
<xsl:for-each select="currencylist/countries">
<xsl:value-of select="position()"/>
</xsl:for-each>
</xsl:template>
<xsl:template name="select_country" match="currencylist">
<xsl:for-each select="currencylist/countries">
<xsl:value-of select="country"/>
</xsl:for-each>
</xsl:template>
<xsl:template name="select_currency" match="currencylist">
<xsl:for-each select="currencylist/countries">
<xsl:value-of select="currency"/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Kindly help me out in this to produce a output in the table.
© Stack Overflow or respective owner