![]() |
How to create dynamic table |
Post Reply
|
| Author | |
hinhnguyen
Newbie
Joined: 16 Nov 2010 Posts: 7 |
Post Options
Quote Reply
Topic: How to create dynamic tablePosted: 16 Nov 2010 at 3:58am |
|
I have the following XML: <?xml version="1.0" encoding="UTF-8"?>
<BLOKK>
<NAVN>Test kravblokk</NAVN>
<BESKRIVELSE>Vi tester generering</BESKRIVELSE>
<RADER>
<RAD>
<KRAVTYPE>Standard</KRAVTYPE>
<KOLONNER>
<KOLONNE>
<NAVN>Krav</NAVN>
<VERDI>Forsinkelsesrente, restskatt</VERDI>
<TYPE>xs:string</TYPE>
</KOLONNE>
<KOLONNE>
<NAVN>Ã…r/termin</NAVN>
<VERDI>2008</VERDI>
<TYPE>xs:string</TYPE>
</KOLONNE>
<KOLONNE>
<NAVN>Forfall</NAVN>
<VERDI>25.01.2010</VERDI>
<TYPE>xs:string</TYPE>
</KOLONNE>
<KOLONNE>
<NAVN>Kravbeløp</NAVN>
<VERDI>450</VERDI>
<TYPE>xs:string</TYPE>
</KOLONNE>
<KOLONNE>
<NAVN>Betalt</NAVN>
<VERDI>0</VERDI>
<TYPE>xs:string</TYPE>
</KOLONNE>
<KOLONNE>
<NAVN>Utestående</NAVN>
<VERDI>450</VERDI>
<TYPE>xs:string</TYPE>
</KOLONNE>
</KOLONNER>
<RADNUMMER>1</RADNUMMER>
</RAD>
<RAD>
<KRAVTYPE>Standard</KRAVTYPE>
<KOLONNER>
<KOLONNE>
<NAVN>Krav</NAVN>
<VERDI>Restskatt</VERDI>
<TYPE>xs:string</TYPE>
</KOLONNE>
<KOLONNE>
<NAVN>Ã…r/termin</NAVN>
<VERDI>2008/1</VERDI>
<TYPE>xs:string</TYPE>
</KOLONNE>
<KOLONNE>
<NAVN>Forfall</NAVN>
<VERDI>20.08.2009</VERDI>
<TYPE>xs:string</TYPE>
</KOLONNE>
<KOLONNE>
<NAVN>Kravbeløp</NAVN>
<VERDI>6 518</VERDI>
<TYPE>xs:string</TYPE>
</KOLONNE>
<KOLONNE>
<NAVN>Betalt</NAVN>
<VERDI>2000</VERDI>
<TYPE>xs:string</TYPE>
</KOLONNE>
<KOLONNE>
<NAVN>Utestående</NAVN>
<VERDI>4 518</VERDI>
<TYPE>xs:string</TYPE>
</KOLONNE>
</KOLONNER>
<RADNUMMER>2</RADNUMMER>
</RAD>
<RAD>
<KRAVTYPE>Standard</KRAVTYPE>
<KOLONNER>
<KOLONNE>
<NAVN>Krav</NAVN>
<VERDI>Restskatt</VERDI>
<TYPE>xs:string</TYPE>
</KOLONNE>
<KOLONNE>
<NAVN>Ã…r/termin</NAVN>
<VERDI>2008/2</VERDI>
<TYPE>xs:string</TYPE>
</KOLONNE>
<KOLONNE>
<NAVN>Forfall</NAVN>
<VERDI>24.09.2009</VERDI>
<TYPE>xs:string</TYPE>
</KOLONNE>
<KOLONNE>
<NAVN>Kravbeløp</NAVN>
<VERDI>6 518</VERDI>
<TYPE>xs:string</TYPE>
</KOLONNE>
<KOLONNE>
<NAVN>Betalt</NAVN>
<VERDI>0</VERDI>
<TYPE>xs:string</TYPE>
</KOLONNE>
<KOLONNE>
<NAVN>Utestående</NAVN>
<VERDI>6 518</VERDI>
<TYPE>xs:string</TYPE>
</KOLONNE>
</KOLONNER>
<RADNUMMER>3</RADNUMMER>
</RAD>
<RAD>
<KRAVTYPE>Standard</KRAVTYPE>
<KOLONNER>
<KOLONNE>
<NAVN>Krav</NAVN>
<VERDI>Påløpte forsinkelsesrenter</VERDI>
<TYPE>xs:string</TYPE>
</KOLONNE>
<KOLONNE>
<NAVN>Ã…r/termin</NAVN>
<TYPE>xs:string</TYPE>
</KOLONNE>
<KOLONNE>
<NAVN>Forfall</NAVN>
<TYPE>xs:string</TYPE>
</KOLONNE>
<KOLONNE>
<NAVN>Kravbeløp</NAVN>
<TYPE>xs:string</TYPE>
</KOLONNE>
<KOLONNE>
<NAVN>Betalt</NAVN>
<TYPE>xs:string</TYPE>
</KOLONNE>
<KOLONNE>
<NAVN>Utestående</NAVN>
<VERDI>100</VERDI>
<TYPE>xs:string</TYPE>
</KOLONNE>
</KOLONNER>
<RADNUMMER>4</RADNUMMER>
</RAD>
<RAD>
<KRAVTYPE>Sum</KRAVTYPE>
<KOLONNER>
<KOLONNE>
<NAVN/>
<VERDI>Summering</VERDI>
<TYPE>xs:string</TYPE>
</KOLONNE>
<KOLONNE>
<NAVN/>
<VERDI/>
<TYPE>xs:string</TYPE>
</KOLONNE>
<KOLONNE>
<NAVN/>
<VERDI/>
<TYPE>xs:string</TYPE>
</KOLONNE>
<KOLONNE>
<NAVN/>
<VERDI>13486</VERDI>
<TYPE>xs:string</TYPE>
</KOLONNE>
<KOLONNE>
<NAVN/>
<VERDI>2000</VERDI>
<TYPE>xs:string</TYPE>
</KOLONNE>
<KOLONNE>
<NAVN/>
<VERDI>11586</VERDI>
<TYPE>xs:string</TYPE>
</KOLONNE>
</KOLONNER>
<RADNUMMER>5</RADNUMMER>
</RAD>
</RADER>
</BLOKK>and want to create a dynamic table by using following XSL transform:
How can I create the similar table in XF-Designer? I have tried different ways in XFD but could not get the desired result. I can paste the XSLT directly in "Code View" but the "Design View" will then show nothing. |
|
![]() |
|
srivatsahg
Newbie
Joined: 06 Oct 2010 Location: Stuttgart Posts: 36 |
Post Options
Quote Reply
Posted: 16 Nov 2010 at 4:29am |
|
Try using the repeating section in XF Designer !!
It works... !! |
|
![]() |
|
hinhnguyen
Newbie
Joined: 16 Nov 2010 Posts: 7 |
Post Options
Quote Reply
Posted: 16 Nov 2010 at 8:38am |
|
Thanks for your reply.
I could get it work by using repeating table but I have to define the number of table columns. How to build the number of table columns dynamic?
|
|
![]() |
|
florinv
Admin Group
Joined: 19 May 2008 Posts: 82 |
Post Options
Quote Reply
Posted: 16 Nov 2010 at 8:58am |
|
Created repeated columns is not supported visually, but you can do this from XSLT.
Go to Insert/XSLT Code and paste the following: <fo:table table-layout="fixed" width="100%"> <xsl:for-each select="BLOKK/RADER/RAD[1]/KOLONNER/KOLONNE"> <fo:table-column column-width="proportional-column-width(1)"/> </xsl:for-each> <fo:table-header> <fo:table-row background-color="#9acd32"> <xsl:for-each select="BLOKK/RADER/RAD[1]/KOLONNER/KOLONNE"> <fo:table-cell> <fo:block> <xsl:value-of select="NAVN"/> </fo:block> </fo:table-cell> </xsl:for-each> </fo:table-row> </fo:table-header> <fo:table-body> <xsl:for-each select="BLOKK/RADER/RAD"> <fo:table-row> <xsl:for-each select="KOLONNER/KOLONNE"> <fo:table-cell> <fo:block> <xsl:value-of select="VERDI"/> </fo:block> </fo:table-cell> </xsl:for-each> </fo:table-row> </xsl:for-each> </fo:table-body> </fo:table> |
|
![]() |
|
hinhnguyen
Newbie
Joined: 16 Nov 2010 Posts: 7 |
Post Options
Quote Reply
Posted: 17 Nov 2010 at 3:31am |
|
Thanks florinv, I have learned a new way to include XSLT in XFD but what I need is showing the table in the design view.
I have solved the problem by create the number of columns static and then let XFD fill the content into the columns dynamic. By this way the table will be visible in the design view Edited by hinhnguyen - 17 Nov 2010 at 3:34am |
|
![]() |
|
Post Reply
|
| Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |