Search code examples
xsltxsl-fo

XSL font-size calculation


I'm new in xsl, and have a question about the calculation of font-size.

I always use a certain number in font-size like font-size="16pt".

Is there any possibility that I can calculate the font-size?

I tried font-size="100 div 5" or using a parameter like font-size="$fontsize" but neither works fine.


Solution

  • I tried font-size="100 div 5" or using a parameter like font-size="$fontsize" but neither works fine.

    Try:

    font-size="{100 div 5}" 
    

    or:

    font-size="{$fontsize}" 
    

    For explanation, see: Attribute Value Templates


    Note that you can always use the more verbose method:

    <xsl:attribute name="font">
        <xsl:value-of select="100 div 5"/>
    </xsl:attribute>