Re: [xsl] XSL:FO dynamic font size based on width

Subject: Re: [xsl] XSL:FO dynamic font size based on width
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 27 Jun 2008 14:20:02 +0100
   <xsl:variable name="title">
            <xsl:value-of select="."/>
         </xsl:variable>

It's almost always better (and always more efficient)
to go

   <xsl:variable name="title" select="."/>

or

   <xsl:variable name="title" select="string(.)"/>

The first refers to the original element, the second makes a string, but


       <xsl:variable name="title">
            <xsl:value-of select="."/>
         </xsl:variable>

makes a document node (result tree fragment in xslt 1) with a child
rtext node, which is a much more expensive thing.
 <xsl:value-of select="46 div (string-length($title) div
28)"/>

that's just


 <xsl:value-of select="1288 div string-length($title)"/>

pt
            </xsl:when>

better to use

  <xsl:text>pt</xsl:text>

otherwise you'll put a linebreak and 12 spaces into each attribute
value, the linebreak will also  be &-escaped.

> The formula is reflective exponential
well it's just a reciprocal not an exponential function.

David

________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. 
________________________________________________________________________

Current Thread