[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] summation of attributes


Subject: [xsl] summation of attributes
From: michael.bierenfeld@xxxxxxxx
Date: Tue, 27 May 2003 10:04:29 +0200

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



Current Thread