CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2008
    Posts
    3

    XSL-FO Display data in Table format

    XML file

    <Report>
    <headers>
    <header id="c0" type="string">
    <name>Type</name>
    <label>Type</label>
    </header>
    <header id="c1" type="string">
    <name>Name</name>
    <label>Name</label>
    </header>
    <header id="c2" type="string">
    <name>Rev</name>
    <label>Revision</label>
    <header id="c3" type="string">
    <name>Desc</name>
    <label>Description</label>
    </header>

    <objects>
    <row type="Woven" name="0000001" rev="1" current="Initiated" policy="Raw Material" symbolicType="type_Woven">
    <cell index="0" colRef="c0">
    <value>Woven</value>
    </cell>
    <cell index="1" colRef="c1">
    <value>0000001</value>
    </cell>
    <cell index="2" colRef="c2">
    <value>1</value>
    </cell>
    <cell index="3" colRef="c3">
    <value>DeDescription</value>
    </cell>
    <cell index="4" colRef="c4">
    <value>Initiated</value>
    </cell>
    </row>
    </objects>
    </Report>

    Output should be in format:
    Type : Woven Name : 0000001
    Revision : 1 Status :Initiated

    XSL:

    <fo:table width="25%" border="0pt solid gray" padding="3pt">
    <fo:table-column/>
    <fo:table-body>
    <xsl:for-each select="./headers/header">
    <fo:table-row >
    <xsl:if test="position() mod 2 = 1">
    <xsl:attribute name="background-color">#dddecb</xsl:attribute>
    <fo:table-cell xsl:use-attribute-sets="tableCell">
    <fo:block font-weight="bold" font-family="Verdana-Bold" font-size="15pt">
    <xsl:value-of select="label"/>
    </fo:block>
    </fo:table-cell>
    </xsl:if>
    </fo:table-row>
    </xsl:for-each>
    </fo:table-body>
    </fo:table>
    <xsl:template name="create-value-odd-tab">
    <fo:table width="25%" border="0pt solid gray" padding="3pt">
    <fo:table-column/>
    <fo:table-body>
    <xsl:for-each select="./objects/row/cell">
    <fo:table-row >
    <xsl:if test="position() mod 2 = 1">
    <xsl:attribute name="background-color">#eeeeee</xsl:attribute>
    <fo:table-cell xsl:use-attribute-sets="tableCell">
    <fo:block font-weight="bold" font-family="Verdana-Bold" font-size="15pt">
    <xsl:value-of select="value"/>
    </fo:block>
    </fo:table-cell>
    </xsl:if>
    </fo:table-row>
    </xsl:for-each>
    </fo:table-body>
    </fo:table>
    </xsl:template>
    two more tables to shoow even entries..


    To represent the data in XML in above format i am creating 4 different tables.
    I basically want the header and value format data output but it should display two fields on the same row.

    How wud is be possible using single table? or any other alternative way?

    Thanks In Advance!
    Vikram

  2. #2
    Join Date
    Dec 2008
    Posts
    3

    Re: XSL-FO Display data in Table format

    Is it possible to iterate on two nodes? like inside headers for loop can I have for loop on objects node? I tried it but didnt succeed

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured