docbook-apps

  • 1.  Re: [docbook-apps] Font size changes in

    Posted 04-18-2007 21:46
    Re: [docbook-apps] Font size changes in <author> and <affiAh, that's because you don't have a customization of authorgroup at the same level also. By default, authorgroup is handled by the template with match="authorgroup" mode="titlepage.mode" in titlepage.xsl, and it processes its children in mode="titlepage.mode", so your custom templates are bypassed.

    If you add a template like this it should work:

    <xsl:template match="authorgroup" mode="book.titlepage.recto.mode">
    <fo:wrapper>
    <xsl:if test="@id">
    <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
    </xsl:if>
    <xsl:apply-templates mode="book.titlepage.recto.mode"/>
    </fo:wrapper>
    </xsl:template>

    Bob Stayton
    Sagehill Enterprises
    DocBook Consulting
    bobs@sagehill.net


    ----- Original Message -----
    From: Ron Catterall
    To: Bob Stayton
    Cc: docbook-apps@lists.oasis-open.org
    Sent: Tuesday, April 17, 2007 12:16 PM
    Subject: Re: [docbook-apps] Font size changes in <author> and <affiliation>


    Saxon 6.5.5 + XEP 4.9 + Oxygen 8.1 processing



    "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
    <book>

    <subtitle>Subtitle</subtitle>
    <bookinfo>
    <authorgroup>
    <author>
    <firstname>An</firstname>
    <othername role="middle">23pt.</othername>
    <surname>Author</surname>
    <affiliation><orgname>  Organisation Name (12pt.)</orgname></affiliation>
    </author>
    </authorgroup>
    </bookinfo>
    <chapter><para>Some chapter text here.</para></chapter>
    </book>

    with this XSL stylesheet



    <xsl:stylesheet
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
    xmlns:fo="http://www.w3.org/1999/XSL/Format" >
    <xsl:import href="/Applications/Utilities/oxygen/8.1/oxygen/frameworks/docbook/xsl/fo/docbook.xsl" />
    <xsl:param name="xep.extensions" select ="1" />
    <xsl:template match="processing-instruction('lb')">
    <fo:block/>
    </xsl:template>
    <xsl:template match="author" mode="book.titlepage.recto.mode">
    <fo:block font-size="23pt"
    color="blue"
    space-before="20pt"
    keep-with-next.within-column="always">
    ?? <xsl:apply-templates select="." mode="titlepage.mode"/>
    </fo:block>
    <fo:block font-size="12pt"
    color="green"
    space-before="18pt" >
    ?? <xsl:apply-templates select="affiliation" mode="titlepage.mode"/>
    </fo:block>
    </xsl:template>
    </xsl:stylesheet>

    does not apply either color or font-size specifications.




    As I describe in this section of my book:

    http://www.sagehill.net/docbookxsl/TitlePagePrint.html#TitlepageElementTemplates

    you can customize how a particular element is handled on a titlepage by customizing the template in the mode without the "auto" in the mode name, in this case mode="book.titlepage.recto.mode". For example:

    <xsl:template match="author" mode="book.titlepage.recto.mode">
    <fo:block font-size="23pt"
    color="blue"
    space-before="20pt"
    keep-with-next.within-column="always">
    <xsl:apply-templates select="." mode="titlepage.mode"/>
    </fo:block>
    <fo:block font-size="12pt"
    color="green"
    space-before="18pt" >
    <xsl:apply-templates select="affiliation" mode="titlepage.mode"/>
    </fo:block>
    </xsl:template>

    (I use color here just to indicate that it is working).

    Because this template is applied within the block created in the mode name that includes "auto", it will inherit all those attributes, so you need to override any that you don't want.

    In this case, the affiliation would not normally appear on a book titlepage. The default handling of author in fo/titlepage.xsl in mode="titlepage.mode" has one template with a general match on author which also processes the affiliation. But there is a second template that specifically matches on bookinfo/author with priority="2", which takes precedence in this case. That template does not output affiliation. So your customization needs to handle the components of author the way you want them.

    Bob Stayton
    Sagehill Enterprises
    DocBook Consulting
    bobs@sagehill.net



    ----- Original Message -----
    From: Ron Catterall
    To: docbook-apps@lists.oasis-open.org
    Sent: Friday, April 13, 2007 12:04 PM
    Subject: Re: [docbook-apps] Font size changes in <author> and <affiliation>






    Apologies, I should have been more precise. I want <author> in a larger font then <orgname> within <affiliation> within <author>




    On a <book> title page I have a need to have <author> at a bigger font size than <affiliation> (which is within <author>)

    Otherwise no change to standard title page.


    Changing the font-size="..." in

    .

    <xsl:template match="author" mode="book.titlepage.recto.auto.mode">
    <fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format" xsl:use-attribute-sets="book.titlepage.recto.style" font-size="20.736pt" space-before="10.8pt" keep-with-next.within-column="always">
    <xsl:apply-templates select="." mode="book.titlepage.recto.mode"/>

    </fo:block>

    </xsl:template>

    Doesn't work at all (no change), and I presume this should also change the size of <affiliation> as font-size would be inherited. Can anyone help please?



    Ron

    --

    Ron Catterall, Phd, DSc email: ron@catterall.net
    Prolongacion de Hidalgo 140 http://catterall.net/
    San Felipe del Agua tel: +52 951 520 1821
    Oaxaca 68020 Mexico fax: +1 530 348 8309

    --------------------------------------------------------------------- To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org





    --
    Ron Catterall, Phd, DSc email: ron@catterall.net
    Prolongacion de Hidalgo 140 http://catterall.net/
    San Felipe del Agua tel: +52 951 520 1821
    Oaxaca 68020 Mexico fax: +1 530 348 8309
    --------------------------------------------------------------------- To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org




    --
    Ron Catterall, Phd, DSc email: ron@catterall.net
    Prolongacion de Hidalgo 140 http://catterall.net/
    San Felipe del Agua tel: +52 951 520 1821
    Oaxaca 68020 Mexico fax: +1 530 348 8309


  • 2.  Re: [docbook-apps] Font size changes in

    Posted 04-19-2007 15:48
    
    
    Thanks Bob, now it uses my customization, BUT the affiliation appears twice, the first time large large and blue, the second small and green.  It seems that

        <xsl:apply-templates select="." mode="titlepage.mode"/>

    outputs both the author and the affiliation. I think I need to say select="author and not author/affiliation" somehow.

    Ron

    <?xsl version="1.0" ?>
    <xsl:stylesheet
          xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
          xmlns:fo="http://www.w3.org/1999/XSL/Format" >
    <xsl:import href="/Applications/Utilities/oxygen/8.1/oxygen/frameworks/docbook/xsl/fo/docbook.xsl" />
    <xsl:param name="xep.extensions" select ="1" />
    <xsl:template match="processing-instruction('lb')">
    <fo:block/>
    </xsl:template>
    <xsl:template match="authorgroup" mode="book.titlepage.recto.mode">
     
    <fo:wrapper>
       
    <xsl:if test="@id">
         
    <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
       
    </xsl:if>
       
    <xsl:apply-templates mode="book.titlepage.recto.mode"/>
     
    </fo:wrapper>
    </xsl:template>
    <xsl:template match="author" mode="book.titlepage.recto.mode">
     
    <fo:block font-size="23pt"
                color="blue"
                space-before="20pt"
                keep-with-next.within-column="always">
        <xsl:apply-templates select="." mode="titlepage.mode"/>
      </fo:block>
     
    <fo:block font-size="12pt"
                color="green"
                space-before="18pt" >
        <xsl:apply-templates select="affiliation" mode="titlepage.mode"/>
      </fo:block>
    </xsl:template>
    </xsl:stylesheet>


    Ah, that's because you don't have a customization of authorgroup at the same level also.  By default, authorgroup is handled by the template with match="authorgroup" mode="titlepage.mode" in titlepage.xsl, and it processes its children in mode="titlepage.mode", so your custom templates are bypassed.
     
    If you add a template like this it should work:
     
    <xsl:template match="authorgroup" mode="book.titlepage.recto.mode">
      <fo:wrapper>
        <xsl:if test="@id">
          <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
        </xsl:if>
        <xsl:apply-templates mode="book.titlepage.recto.mode"/>
      </fo:wrapper>
    </xsl:template>
     
    Bob Stayton
    Sagehill Enterprises
    DocBook Consulting
    bobs@sagehill.net
     

    Ron Catterall, Phd, DSc       email: ron@catterall.net
    Prolongacion de Hidalgo 140http://catterall.net/
    San Felipe del Aguatel: +52 951 520 1821
    Oaxaca      68020Mexicofax: +1 530 348 8309


  • 3.  Re: [docbook-apps] Font size changes in

    Posted 04-19-2007 20:52
    
    
    Found a way around this duplication: output the firstname, othername and surname separately, but is this the best way?  Still two minor problems:
    1.  need to center the author with 3 non-breaking spaces at end of surname. Messy!  There must be  better way.
    2.  The spaces between the parts of the name are too big - haven't found a way around this yet.

    </xsl:template>
    <xsl:template match="authorgroup" mode="book.titlepage.recto.mode">
     
    <fo:wrapper>
       
    <xsl:if test="@id">
         
    <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
       
    </xsl:if>
       
    <xsl:apply-templates mode="book.titlepage.recto.mode"/>
     
    </fo:wrapper>
    </xsl:template>
    <xsl:template match="author" mode="book.titlepage.recto.mode">
     
    <fo:block font-size="20.736pt"
                color="blue"
                space-before="8pt"
                keep-with-next.within-column="always">
     ??
    <xsl:apply-templates select="firstname" mode="titlepage.mode"/>
     ??
    <xsl:apply-templates select="othername" mode="titlepage.mode"/>
     ??
    <xsl:apply-templates select="surname" mode="titlepage.mode"/>
    <!-- ?? <xsl:apply-templates select="." mode="titlepage.mode"/> -->
     
    </fo:block>
     
    <fo:block font-size="14.4pt"
                color="green"
                space-before="8pt" >
     ??
    <xsl:apply-templates select="affiliation" mode="titlepage.mode"/>
     
    </fo:block>
    </xsl:template>
    <xsl:template match="author" mode="titlepage.mode">
     
    <fo:block>
       
    <xsl:call-template name="anchor"/>
       
    <xsl:call-template name="person.name"/>
       
    <xsl:if test="affiliation/orgname">
         
    <xsl:text> </xsl:text>
         
    <xsl:apply-templates select="affiliation/orgname" mode="titlepage.mode"/>
       
    </xsl:if>
       
    <xsl:if test="email|affiliation/address/email">
         
    <xsl:text> </xsl:text>
         
    <xsl:apply-templates select="(email|affiliation/address/email)[1]"/>
       
    </xsl:if>
     
    </fo:block>
    </xsl:template>

    <xsl:template match="authorgroup" mode="book.titlepage.recto.auto.mode">
    <fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format" xsl:use-attribute-sets="book.titlepage.recto.style" space-before="1.8in">
    <xsl:apply-templates select="." mode="book.titlepage.recto.mode"/>
    </fo:block>
    </xsl:template>

    </xsl:stylesheet>


    Thanks Bob, now it uses my customization, BUT the affiliation appears twice, the first time large large and blue, the second small and green.  It seems that

        <xsl:apply-templates select="." mode="titlepage.mode"/>

    outputs both the author and the affiliation. I think I need to say select="author and not author/affiliation" somehow.

    Ron

    <?xsl version="1.0" ?>
    <xsl:stylesheet
          xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
          xmlns:fo="http://www.w3.org/1999/XSL/Format" >
    <xsl:import href="/Applications/Utilities/oxygen/8.1/oxygen/frameworks/docbook/xsl/fo/docbook.xsl" />
    <xsl:param name="xep.extensions" select ="1" />
    <xsl:template match="processing-instruction('lb')">
    <fo:block/>
    </xsl:template>
    <xsl:template match="authorgroup" mode="book.titlepage.recto.mode">
     
    <fo:wrapper>
       
    <xsl:if test="@id">
         
    <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
       
    </xsl:if>
       
    <xsl:apply-templates mode="book.titlepage.recto.mode"/>
     
    </fo:wrapper>
    </xsl:template>
    <xsl:template match="author" mode="book.titlepage.recto.mode">
     
    <fo:block font-size="23pt"
                color="blue"
                space-before="20pt"
                keep-with-next.within-column="always">
        <xsl:apply-templates select="." mode="titlepage.mode"/>
      </fo:block>
     
    <fo:block font-size="12pt"
                color="green"
                space-before="18pt" >
        <xsl:apply-templates select="affiliation" mode="titlepage.mode"/>
      </fo:block>
    </xsl:template>
    </xsl:stylesheet>


    Ah, that's because you don't have a customization of authorgroup at the same level also.  By default, authorgroup is handled by the template with match="authorgroup" mode="titlepage.mode" in titlepage.xsl, and it processes its children in mode="titlepage.mode", so your custom templates are bypassed.
     
    If you add a template like this it should work:
     
    <xsl:template match="authorgroup" mode="book.titlepage.recto.mode">
      <fo:wrapper>
        <xsl:if test="@id">
          <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
        </xsl:if>
        <xsl:apply-templates mode="book.titlepage.recto.mode"/>
      </fo:wrapper>
    </xsl:template>
     
    Bob Stayton
    Sagehill Enterprises
    DocBook Consulting
    bobs@sagehill.net
     

    --
    Ron Catterall, Phd, DSc       email: ron@catterall.net
    Prolongacion de Hidalgo 140http://catterall.net/
    San Felipe del Aguatel: +52 951 520 1821
    Oaxaca      68020Mexicofax: +1 530 348 8309
    --------------------------------------------------------------------- To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org


    Ron Catterall, Phd, DSc       email: ron@catterall.net
    Prolongacion de Hidalgo 140http://catterall.net/
    San Felipe del Aguatel: +52 951 520 1821
    Oaxaca      68020Mexicofax: +1 530 348 8309