Announcement

Collapse
No announcement yet.

Problem mit margin der Tabelle und mit Bildern in XSLFO (mit Apache FOP)

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem mit margin der Tabelle und mit Bildern in XSLFO (mit Apache FOP)

    Hallo!

    Ich habe folgende Tabelle inder XML-Datei

    Code:
     <table-container type="wide">
                <table type="table_default" hsdl-percent="26.7 7.1 13.4 15.7 17.4 19.8">
                   <thead>
                      <tr>
                         <th colspan="2">
                            <p type="p_table_rb"></p>
                         </th>
                         <th>
                            <p type="p_table_lb"></p>
                         </th>
                         <th>
                            <p type="p_table_lb"></p>
                         </th>
                         <th>
                            <p type="p_table_lb"></p>
                         </th>
                         <th>
                            <p type="p_table_lb"></p>
                         </th>
                      </tr>
                   </thead>
                   <tbody>
                      <tr>
                         <td rowspan="7">
                            <image-container type="img_free"><img src="49181391499.PNG" width="165" height="180"/></image-container>
                            <p type="p_table_l"/>
                            <p type="p_table_l"></p>
                            <p type="p_table_l"></p>
                         </td>
                         <td>
                            <p type="p_table_l"></p>
                         </td>
                         <td>
                            <p type="p_table_l"></p>
                         </td>
                         <td>
                            <p type="p_table_l"></p>
                         </td>
                         <td>
                            <p type="p_table_l"></p>
                         </td>
                         <td>
                            <p type="p_table_l"></p>
                         </td>
                      </tr>
                      <tr>
                         <td>
                            <p type="p_table_l"></p>
                         </td>
                         <td>
                            <p type="p_table_l"></p>
                         </td>
                         <td>
                            <p type="p_table_l"></p>
                         </td>
                         <td>
                            <p type="p_table_l"></p>
                         </td>
                         <td>
                            <p type="p_table_l"></p>
                         </td>
                      </tr>
                      <tr>
                         <td>
                            <p type="p_table_l"></p>
                         </td>
                         <td>
                            <p type="p_table_l"></p>
                         </td>
                         <td>
                            <p type="p_table_l">-</p>
                         </td>
                         <td>
                            <p type="p_table_l">-</p>
                         </td>
                         <td>
                            <p type="p_table_l">-</p>
                         </td>
                      </tr>
                      <tr>
                         <td>
                            <p type="p_table_l"></p>
                         </td>
                         <td>
                            <p type="p_table_l"></p>
                         </td>
                         <td>
                            <p type="p_table_l"></p>
                         </td>
                         <td>
                            <p type="p_table_l"></p>
                         </td>
                         <td>
                            <p type="p_table_l"></p>
                         </td>
                      </tr>
                      <tr>
                         <td>
                            <p type="p_table_l"></p>
                         </td>
                         <td>
                            <p type="p_table_l"></p>
                         </td>
                         <td>
                            <p type="p_table_l"></p>
                         </td>
                         <td>
                            <p type="p_table_l"></p>
                         </td>
                         <td>
                            <p type="p_table_l"></p>
                         </td>
                      </tr>
                      <tr>
                         <td>
                            <p type="p_table_l"></p>
                         </td>
                         <td>
                            <image-container type="img_free"><img src="49181404427.PNG" width="75" height="112"/></image-container>
                         </td>
                         <td>
                            <image-container type="img_free"><img src="49181417355.PNG" width="90" height="109"/></image-container>
                         </td>
                         <td>
                            <image-container type="img_free"><img src="49181430283.PNG" width="106" height="113"/></image-container>
                         </td>
                         <td>
                            <image-container type="img_free"><img src="49181443211.PNG" width="120" height="117"/></image-container>
                         </td>
                      </tr>
                      <tr>
                         <td>
                            <p type="p_table_l"></p>
                         </td>
                         <td colspan="2">
                            <p type="p_table_l"></p>
                            <p type="p_table_l"></p>
                            <p type="p_table_l">4</p>
                            <p type="p_table_l"></p>
                         </td>
                         <td colspan="2">
                            <p type="p_table_l"></p>
                            <p type="p_table_l"></p>
                            <p type="p_table_l"></p>
                            <p type="p_table_l"></p>
                         </td>
                      </tr>
                   </tbody>
                </table>
                <table-footer></table-footer>
             </table-container>

    Folgende Probleme:

    1. Wenn ich dem fo:table einen margin-left="-30mm" gebe, geht die Tabelle wie gewünscht nach links, aber die ganzen p-tags in den fo:table-cells rutschen nach links aus der Tabelle und sogar aus der Seite heraus. Sie werden quasi um eine Spalte nach links verschoben, aus der Tabelle heraus...

    2. Die Grafiken werden angezeigt in der gewünschten Höhe und Breite, aber drumherum wird noch mehr angezeigt. Also die Fläche die fo:external-graphic verwendet, ist größer als die Fläch des Bildes (und teilweise sogar größer als die von <img-container>), d- h- man sieht die Hintergrundfarbe des img-containers (blau) und der fo:external-graphic (rot). was ich ahber nicht haben will.

    3. Die borders, die ich über die attribute-sets hole, werden überall angezeigt, außer bei den beiden <th> und <td> die das rowspan oder colspan-Atrribut haben.

    Vielen Dank schon mal für eure Hilfe!

    Mein XSL-Code für die Tabelle:
    Code:
    <xsl:template match="table-container[@type='wide']">
    		<xsl:apply-templates/>
    	</xsl:template>
    	
    	<xsl:template match="table[@type='table_default']">
    		<fo:table background-color="green" margin-left="-30mm">
    			<xsl:apply-templates/>
    		</fo:table>
    	</xsl:template>
    	
    	<xsl:template match="thead">
    		<fo:table-header>
    			<xsl:apply-templates/>
    		</fo:table-header>
    	</xsl:template>
    	
    	<xsl:template match="tbody">
    		<fo:table-body>
    			<xsl:apply-templates/>
    		</fo:table-body>
    	</xsl:template>
    
    	<xsl:template match="tr">
    		<fo:table-row>
    			<xsl:apply-templates/>
    		</fo:table-row>
    	</xsl:template>
    	
    	<xsl:template match="th | td">
    		<fo:table-cell background-color="yellow" xsl:use-attribute-sets="bordertop borderright borderbottom borderleft">
    			<xsl:choose>
    				<xsl:when test="@colspan">
    					<xsl:attribute name="number-columns-spanned">
    						<xsl:value-of select="@colspan"/>
    					</xsl:attribute>
    				</xsl:when>
    				<xsl:when test="@rowspan">
    					<xsl:attribute name="number-rows-spanned">
    						<xsl:value-of select="@rowspan"/>
    					</xsl:attribute>
    				</xsl:when>
    				<xsl:otherwise>
    				</xsl:otherwise>
    			</xsl:choose>
    			<xsl:apply-templates/>
    		</fo:table-cell>
    	</xsl:template>	
    
    	<xsl:template match="table-footer">
    		<fo:block>
    			<xsl:value-of select="."/>
    		</fo:block>
    	</xsl:template>
    für die Grafiken:

    Code:
    	<xsl:template match="image-container[@type='img_free']">
    		<fo:block background-color="blue">
    			<xsl:apply-templates/>
    		</fo:block>
    	</xsl:template>
    
    	<xsl:template match="img"> 
    		<fo:external-graphic background-color="red">
    			<xsl:attribute name="width">
    				<xsl:value-of select="@width"/>
    			</xsl:attribute>
    			<xsl:attribute name="height">
    				<xsl:value-of select="@height"/>
    			</xsl:attribute>
    			<xsl:attribute name="src">
    				<xsl:value-of select="@src"/>
    			</xsl:attribute>
    		</fo:external-graphic>
    	</xsl:template>
    Und für die p-Tags:

    Code:
    	<xsl:template match="p[@type='p_table_l']">
    		<fo:block font-size="9px" background-color="red">
    			<xsl:value-of select="."/>
    		</fo:block>
    	</xsl:template>
    	
    	<xsl:template match="p[@type='p_table_rb']">
    		<fo:block font-size="9px" background-color="red">
    			<xsl:value-of select="."/>
    		</fo:block>
    	</xsl:template>
    	
    	<xsl:template match="p[@type='p_table_lb']">
    		<fo:block font-size="9px" background-color="red">
    			<xsl:value-of select="."/>
    		</fo:block>
    	</xsl:template>

  • #2
    Hat sich alles erfreulicherweise erledigt! Lag teilweise an Apache FOP. Mit Antenna House klappts.

    Comment

    Working...
    X