Velikost title pro section jako velikost title pro chapter?

Jan Tošovský j.tosovsky na tiscali.cz
Čtvrtek Únor 4 19:44:01 CET 2010


> Ovšem vrtá mi hlavou ještě jedna věc:
> V html jsem si do template section.title přidal další řádek:
> <xsl:when test="$section/@renderas = 'chapter'">0</xsl:when>
> a pro toto renderas jsem v tomto template definoval:
> <xsl:when test="$renderas = '0'">
>         <xsl:call-template name="component.title">
>           <xsl:with-param name="node" select="$section"/>
>         </xsl:call-template>
> Tímto jsem dosáhl toho, co jsem chtěl, tedy že si můžu 
> nastavovat renderas="chapter" a v html to dělá, co chci. 
> (Nevím, nakolik je to košer.)
> Ale v pdf jsem si udělal:
> <xsl:attribute-set name="section.title.level1.properties">
>   <xsl:attribute name="background-color">
>     <xsl:choose>
>       <xsl:when test="@renderas='chapter'">rgb(186, 219, 
> 100)</xsl:when>
>       <xsl:otherwise>#E0E0E0</xsl:otherwise>
>     </xsl:choose>
>   </xsl:attribute>  
>   <xsl:attribute name="font-size">
>         <xsl:value-of select="$body.font.master * 2.48832"/>
>         <xsl:text>pt</xsl:text>
>   </xsl:attribute>  
> </xsl:attribute-set>
> Jenže to nefunguje ani s renderas="chapter", ani s 
> role="chapter" (když změním výše uvedené renderas na role.
> Kde je problém nyní? Nepotřebuji všechny level1 udělat ve 
> velikosti chapter, ale chci to nějak ovládat, napadly mě jen 
> tyto dva atributy. 

Upravy bude nutne udelat o krok drive (sections.xsl):

<xsl:template match="section">
  <xsl:choose>
    <xsl:when test="$rootid = @id or $rootid = @xml:id">
      <xsl:call-template name="section.page.sequence"/>
    </xsl:when>
    <xsl:otherwise>
      <xsl:variable name="id">
        <xsl:call-template name="object.id"/>
      </xsl:variable>

      <xsl:variable name="renderas">
        <xsl:choose>
(x)       <xsl:when test="@renderas = 'sect1'">1</xsl:when>
          <xsl:when test="@renderas = 'sect2'">2</xsl:when>
          <xsl:when test="@renderas = 'sect3'">3</xsl:when>
          <xsl:when test="@renderas = 'sect4'">4</xsl:when>
          <xsl:when test="@renderas = 'sect5'">5</xsl:when>
          <xsl:otherwise><xsl:value-of select="''"/></xsl:otherwise>
        </xsl:choose>
      </xsl:variable>

kde bych radek (x) zmenil na  
<xsl:when test="@renderas = 'sect1' or @renderas = 'chapter'">1</xsl:when>

Jen tak se podle me bude mit ta nastinena podminka v
section.title.level1.properties nejaky smysl.




Další informace o konferenci Docbook