This is the mail archive of the docbook-apps@lists.oasis-open.org mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [docbook-apps] Tighten up : Title page <author> layout


On Thu, Apr 07, 2005 at 01:58:19AM -0400, Fiedler, Tristan wrote:

> <author>
>   <firstname>Joe</firstname>
>   <surname>Smith
>     <remark>
>        <footnote><para>Footnote1.</para></footnote>
>        <footnote><para>Footnote2.</para></footnote>
>     </remark>
>    </surname>
> 			
>   <affiliation>
>     <orgname>University of Maryland</orgname>
>     <address>Baltimore, MD 21250 USA</address>
>   </affiliation>
>   <email>Smith@umbc.edu</email>
> </author>
> 
> HTML output looks like :
> 
> <div>
>  <div class="author">
>   <h3 class="author"><span class="firstname"> Joe </span> 
>                      <span class="surname">Smith<em><span class="remark">
>                      <sup .footnotelink1.. </sup> 
>                      <sup .footnotelink2.. </sup>
>                      </span></em></span>
>   </h3>
>   <div class="affiliation"><span class="orgname">University of Maryland<br></span>
>   <div class="address"><p>Baltimore,&nbsp;MD&nbsp;21250&nbsp;USA</p>
>   </div>
>   </div>
>   <code class="email">&lt;<a href="mailto:smith@umbc.edu";>smith@umbc.edu</a>&gt;</code>
>  </div>
> </div>
>       
> While this HTML looks fine, I want to re-style the author section in
> the HTML output to have much less whitespace, ie. remove the <br>
> and <p></p> perhaps and replace with comma's to put all the
> information on a single line with the author is slightly larger
> font.

You could do it by overriding a few templates in html/titlepage.xsl.
Start with:

<xsl:template match="author" mode="titlepage.mode">
  <div class="{name(.)}">
    <span class="{name(.)}"><xsl:call-template name="person.name"/></span>
    <xsl:apply-templates mode="titlepage.mode" select="./contrib"/>
    <xsl:apply-templates mode="titlepage.mode" select="./affiliation"/>
    <xsl:apply-templates mode="titlepage.mode" select="./email"/>
  </div>
</xsl:template>

Here, I've put 'author' inside a 'span' instead of a 'h3'.  This will
prevent the first line break.  You could then use CSS to increase the
font size of span.firstname and span.lastname, or all of
span.author---whatever suits.  You're not using 'contrib', so I'll
ignore that.  Then adjust the templates for 'affiliation', 'orgname'
and 'address' to remove the 'div', 'br' and 'p' elements:

<xsl:template match="affiliation" mode="titlepage.mode">
  <span class="{name(.)}">
    <xsl:apply-templates mode="titlepage.mode"/>
  </span>
</xsl:template>

<xsl:template match="orgname" mode="titlepage.mode">
  <span class="{name(.)}">
    <xsl:apply-templates mode="titlepage.mode"/>
  </span>
  <xsl:text>, </xsl:text>
</xsl:template>

<xsl:template match="address" mode="titlepage.mode">
  <span class="{name(.)}">
    <xsl:apply-templates mode="titlepage.mode"/>
  </span>
  <xsl:text>, </xsl:text>
</xsl:template>

I've removed some functionality from the address template, but it
should supply the output you're after.  The placement of the commas is
somewhat brittle, and you would need to do something more
sophisticated if your input was different.

I have not tested any of this code, but it should be close.  :-)


-- 
Paul.

w  http://logicsquad.net/
h  http://paul.hoadley.name/

Attachment: pgp00000.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]