There is no function in XSLT that can return the value of the current font-size, but there is in XSL-FO. The distinction is that XSLT functions are processed by the XSLT processor such as Saxon or xsltproc, and XSL-FO functions are processed by the XSL-FO processor such as FOP or XEP. The XSLT processor does not know what the "current" font-size is, but the XSL-FO processor does.

Depending on your processor, it may support the inherited-property-value() function described in the XSL standard. Since FOP 0.95 claims to support it, I suspect most do. See:

http://www.w3.org/TR/xsl/#d0e5961

Bob Stayton
Sagehill Enterprises
[email protected]


----- Original Message ----- From: "Jacques Foucry" <[email protected]>
To: "docbook-apps" <[email protected]>
Sent: Friday, March 05, 2010 6:09 AM
Subject: [docbook-apps] Access to ancestor Font-size definition


On 18 avr. 2008, at 01:20, Bob Stayton wrote:
Hello,

A long time ago I had a problem for resizing fonts in different context and Bob gave me this answer which until today.
<fo:inline xmlns:fo="http://www.w3.org/1999/XSL/Format"; font-family="LucidaGrande" font-weight="normal">
<xsl:attribute name="font-size">
  <xsl:choose>
    <xsl:when test="ancestor::title
                    or ancestor::literal
                    or ancestor::filename
                    or ancestor::programlisting
                    or ancestor::literallayout">0.9em</xsl:when>
    <xsl:otherwise>0.8em</xsl:otherwise>
  </xsl:choose>
</xsl:attribute>


I found that in some case the font-size is too big or too small. So I tried to correct by using, instead of 0.9em size the ancestor font-size and a value. The first problem is to access to the ancestor font size :

            <xsl:attribute name="font-size">
               <xsl:choose>
                   <xsl:when test="ancestor::d:title
                       or ancestor::d:info
                       or ancestor::d:literal
                       or ancestor::d:filename
                       or ancestor::d:programlisting
or ancestor::d:literallayout"><xsl:value-of select="ancestor::?????"/></xsl:when>
                   <xsl:otherwise>0.75em</xsl:otherwise>
               </xsl:choose>
           </xsl:attribute>

And I don't know what to put to replace my ?????

May be I'm on the wrong way, but I have no other ideas.

Thanks in advance for your help,

Jacques
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]




---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to