hello
       i am facing a problem regarding which i sent en email. the problem is explained here:

The xml file is shown here:


<start>
<generalinfo>
<component top="150" left="20" width="100" height="20"> GI 1</component>
<component top="150" left="120" width="100" height="20"> GI 2</component>
<component top="200" left="20" width="100" height="20"> GI 3</component>
<component top="200" left="120" width="100" height="20"> GI 4</component>
</generalinfo>
<userdefined name="User Defined Data">
<table top="1100" left="120" width="400" height="300">
<!-- the table will be show in the next(2nd) page with top='300' -->
<tbody>
<tr>
<th>Attribute</th>
<th>Value</th>
</tr>
<tr>
<td>A</td>
<td>B</td>
</tr>
<tr>
<td>C</td>
<td>D</td>
</tr>
</tbody>
</table>
</userdefined> 
<lastinfo>
<!-- these informations will be show in the next(2nd) page with top='600' -->
<component top="1400" left="20" width="100" height="20"> GI 1</component>
<component top="1400" left="120" width="100" height="20"> GI 2</component>
</lastinfo>

</start>

To show the contents in pdf file at there fixed position i use
<fo:block-container> and its attributes(top,left,width,height)
is set from the xml file. the xsl file is as follows :

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format">

<xsl:output indent="yes"/>
<xsl:template match="/">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">

<fo:layout-master-set>
<fo:simple-page-master master-name="only" page-width="210mm"
page-height="900px" margin-top="0.5in" margin-bottom="0.5in"
margin-left="0.3in" margin-right="0.2in">
<fo:region-start extent="0.3in"/>
<fo:region-before extent="0.5in"/>
<fo:region-body margin="0.5in"/>
<fo:region-end extent="0.2in"/>
<fo:region-after extent="0.5in"/>
</fo:simple-page-master>
</fo:layout-master-set>

<fo:page-sequence master-reference="only" initial-page-number="1">
<fo:flow flow-name="xsl-region-body">
<xsl:apply-templates/>
</fo:flow>
</fo:page-sequence>

</fo:root>
</xsl:template>
 
<xsl:template match="generalinfo">
<xsl:apply-templates/>
</xsl:template>

<xsl:template match="generalinfo">
<xsl:apply-templates/>
</xsl:template>

<xsl:template match="component">
<fo:block-container position="absolute">
<xsl:attribute name="top">
<xsl:value-of select="./@top"/>px
</xsl:attribute>
<xsl:attribute name="left">
<xsl:value-of select="./@left"/>px
</xsl:attribute>
<xsl:attribute name="width">
<xsl:value-of select="./@width"/>px
</xsl:attribute>
<xsl:attribute name="height">
<xsl:value-of select="./@height"/>px
</xsl:attribute>
<fo:block>
<xsl:value-of select="text()"/>
</fo:block>
</fo:block-container>
</xsl:template>
 
<xsl:template match="userdefined">
<xsl:apply-templates/>
</xsl:template>

<xsl:template match="table">
<fo:block-container position="absolute">
<xsl:attribute name="top">
<xsl:value-of select="./@top"/>px
</xsl:attribute>
<xsl:attribute name="left">
<xsl:value-of select="./@left"/>px
</xsl:attribute>
<xsl:attribute name="width">
<xsl:value-of select="./@width"/>px
</xsl:attribute>
<xsl:attribute name="height">
<xsl:value-of select="./@height"/>px
</xsl:attribute>

<fo:block>
<xsl:apply-templates/>
</fo:block>

</fo:block-container>
</xsl:template>

<xsl:template match="tbody">
<fo:table>
<xsl:for-each select="tr[1]/th">
<fo:table-column column-width="150px"/>
</xsl:for-each>

<fo:table-body>
<xsl:apply-templates/>
</fo:table-body>
</fo:table>
</xsl:template>
 
<xsl:template match="tr">
<fo:table-row>
<xsl:apply-templates/>
</fo:table-row>
</xsl:template>
 
<xsl:template match="th">
<fo:table-cell font-weight="bold" text-align="center">
<fo:block>
<xsl:apply-templates/>
</fo:block>
</fo:table-cell>
</xsl:template>
 
<xsl:template match="td">
<fo:table-cell>
<fo:block>
<xsl:apply-templates/>
</fo:block>
</fo:table-cell>
</xsl:template>
 
</xsl:stylesheet>


But unfortunately it is not working. if i made the
top attribute of the table element in the xml file
and use <fo:block break-before="page"> for a template
match of <xsl:template match="table"> then it works
fine. isthere any other way to solve this? i mean
depending on the value(of top ) from the xml the
formatter will itself show the content in the next
page.

pls help me.


Do you Yahoo!?
Free online calendar with sync to Outlook(TM).

Reply via email to