Why is it that, table is not printing in the xsl-fo here? please help me guys.

Posted by atrueguy on Stack Overflow See other posts from Stack Overflow or by atrueguy
Published on 2010-05-13T08:36:05Z Indexed on 2010/05/13 8:44 UTC
Read the original article Hit count: 337

Filed under:
|
|

This is my xml file

<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="currency.xsl"?>
<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 xsl-fo file:

<?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="0.7in" margin-top="1.2in" margin-left="1.1in"/>
                    <fo:region-before region-name="xsl-region-before" extent="1.5in" />
                    <fo:region-after region-name="xsl-region-after" extent="1.5in" />
                    <fo:region-start region-name="xsl-region-after" extent="1.5in" />
                </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>
                                <xsl:for-each select="currencylist/countries">
                                    <fo:table-row>
                                        <fo:table-cell>
                                            <fo:block>
                                                <xsl:value-of select="position()"/>
                                            </fo:block>
                                        </fo:table-cell>
                                        <fo:table-cell>
                                            <fo:block>
                                                <xsl:value-of select="country"/>
                                            </fo:block>
                                        </fo:table-cell>
                                        <fo:table-cell>
                                            <fo:block>
                                                <xsl:value-of select="currency"/>
                                            </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:template name="show_title" match="currencylist">
       <xsl:value-of select="currencylist/title"/>
    </xsl:template>

</xsl:stylesheet> 

Table structure is not printing, but the values are printing, please help guys.

© Stack Overflow or respective owner

Related posts about Xml

Related posts about xsl