xsl-list
[Top] [All Lists]

summation of attributes

2003-05-27 01:04:29
Hi there, 
 
I am having a fop document that has to be transferred to html. Right now I am 
struugling with the following situation. 
 
fop.xml : 
 
*snip* 
<fo:table width="100%"> 
 
        <fo:table-column column-width="proportional-column-width(68)"/> 
        <fo:table-column column-width="proportional-column-width(95)"/> 
 
        .... continued .... 
 
</fo:table> 
*snip> 
 
this has to be transferred to 
 
<table> 
        <colgroup> 
                <col width="41%"/>     <!-- 68 * 100 / (68 + 95) --> 
                <col width="59%"/>     <!-- 95 * 100 / (68 + 95) --> 
        </colgroup> 
 
    .. continued ... 
</table> 
 
right know I am using the following templates 
 
<xsl:template match="fo:table"> 
        <table> 
                <xsl:variable name="summated_attributes" 
select="sum(fo:table-column/ @column-width)"/> 
                <colgroup> 
                        <xsl:apply-templates match="fo:table-column"> 
                                <xsl:with-param name="total_sum" 
value="$summated_attributes"/> 
                        </xsl:apply-templates> 
                </colgroup> 
        </table> 
</xsl:template> 
 
<xsl:template match="fo:table-column"> 
        <xsl:param-name="total_sum"/> 
        <col> 
                <xsl:attribute name="width" select="@column-width * 100 div 
$total_sum">%</xsl:attribute> 
        </col> 
</xsl:template> 
 
unfortunatly column-width is encoded as "proportinal-column-with(68)" where 68 
is the value I need therefore I am also doing 
 
<xsl:template match="@column-width"> 
        <xsl:value-of select="substring(., 27,2)"/> 
</xsl:template> 
 
_but this is not working_ 
 
does anybody have an idea ? 
 
Michael 
 
 
 
 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>