RE: Velikost title pro section jako velikost title pro chapter?
Tomas.Waller
Tomas.Waller na seznam.cz
Pátek Únor 5 12:17:33 CET 2010
> ------------ Původní zpráva ------------
> Od: Jan Tošovský <j.tosovsky na tiscali.cz>
> Předmět: RE: Velikost title pro section jako velikost title pro chapter?
> Datum: 04.2.2010 19:44:25
> ----------------------------------------
> > 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.
>
Zkusil jsem, ale nepomáhá.
Použil jsem attribute-set (varianty pro role="mytitle" i renderas="chapter"):
<xsl:attribute-set name="section.title.level1.properties">
<xsl:attribute name="background-color">
<xsl:choose>
<xsl:when test="@role='mytitle'">rgb(186, 219, 100)</xsl:when>
<xsl:otherwise>#E0E0E0</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:attribute name="font-size">
<xsl:choose>
<xsl:when test="@role='mytitle'">
<xsl:value-of select="$body.font.master * 2.43882"/>
<xsl:text>pt</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$body.font.master * 4.43882"/>
<xsl:text>pt</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
</xsl:attribute-set>
ignoruje jak podmínky a vždy bere otherwise.
Na rozdíl od tohoto level1, level2 dělá, co má, když je pro ni použit stejný attribute-set. Atribut role pro section na první úrovni nefunguje? Pro druhou funguje.
Tomáš Waller
Další informace o konferenci Docbook