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: Re: Q's:Adding affiliation to authorgroup template


I had only looked at my customization layer and not tried that myself. Sorry
for that. The error was (as Bob pointed out) that affiliation is a child of
author.
So you need to include both author and affiliation. Additionally you need to
provide a custom version of affiliation for the titlepage which why included
it in the customization layer.

I think it is fine to use the attribute 'predicate' since:
Each element may have a single attribute: predicate. The value of this
attribute is used as a predicate for the expression that matches the element
on which it occurs. (From Norm's documentation)

You may take a look at the template and the customization layer enclosed.
They work for me.

Hope this helps
Martin

title-sample.xml
<?xml version="1.0"?>
<t:templates
  xmlns:t="http://nwalsh.com/docbook/xsl/template/1.0";
  xmlns:fo="http://www.w3.org/1999/XSL/Format";>

  <t:titlepage element="book" wrapper="fo:block">
    <t:titlepage-content side="recto" order="stylesheet">
      <title predicate="[1]"
        fo:font-size="24pt"
        fo:font-family="{$title.font.family}"
        fo:font-weight="bold"
        fo:space-before.optimum="2cm"
        fo:space-before.minimum="1.8cm"
        fo:space-before.maximum="2.2cm"
        fo:text-align="center"
        fo:hyphenate="false"
        fo:keep-with-next.within-column="always"/>

      <authorgroup predicate="/author/affiliation"/>

    </t:titlepage-content>
  </t:titlepage>
</t:templates>

and the customization layer
<?xml version="1.0" encoding="ISO-8859-1"?>

<xsl:stylesheet
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
  xmlns:fo="http://www.w3.org/1999/XSL/Format";
  xmlns:saxon="http://icl.com/saxon";
  version="1.0">

  <xsl:import href="../docbook-xsl-1.57.0/fo/docbook.xsl"/>
  <!-- customized titlepages -->
  <xsl:include href="title-sample.xsl"/>

  <!-- indent output -->
  <xsl:output method="xml" indent="yes" encoding="ISO-8859-1"
     saxon:next-in-chain="table-patch-for-fop.xsl"/>

  <!-- orgname on titlepage -->
  <xsl:template match="affiliation" mode="book.titlepage.recto.auto.mode">
    <fo:block
      font-size="16pt"
      font-family="{$title.font.family}"
      font-weight="bold"
      text-align="center"
      hyphenate="false"
      keep-with-next.within-column="always">
      <xsl:value-of select="orgname"/>
    </fo:block>
  </xsl:template>
  <xsl:param name="use.extensions" select="1"/>
</xsl:stylesheet>



----- Original Message -----
From: "Bob Stayton" <bobs@caldera.com>
To: "Val Schmidt" <vschmidt@ldeo.columbia.edu>; "Martin Stemplinger"
<mstemplinger@gmx.de>
Cc: <docbook-apps@lists.oasis-open.org>
Sent: Wednesday, November 06, 2002 6:12 AM
Subject: Re: DOCBOOK-APPS: Re: Q's:Adding affiliation to authorgroup
template


> On Tue, Nov 05, 2002 at 06:12:48PM -0500, Val Schmidt wrote:
> > Hmmm.
> >
> > Do you have your "author" elements embedded in "authorgroup" tags in
> > your source xml?
> >
> > I do, the result is that the <authorgroup/>
> > portion of the template is all that produces stylesheet code that
> > impacts the style and format of the authors.
> >
> > I stuck the "predicate" line into the authorgroup tag with no results.
> > I removed it and then added a second <authorgroup
> > predicate="/affiliation"/> below it. It generated this:
> > _____________________
> >   <xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
> > mode="book.titlepage.recto.auto.mode" select="bookinfo/authorgroup"/>
> >
> >   <xsl:apply-templates xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
> > mode="book.titlepage.recto.auto.mode"
> > select="bookinfo/authorgroup/affiliation"/>
> > ______________________
> > This looks promising but again doesn't work.
> >
> > I'm afraid I'm stabbing in the dark.
> >
> > Do I need to rewrite the authorgroup template? (Yikes!)
> >
> > Val
> >
> > On Tue, 2002-11-05 at 17:24, Martin Stemplinger wrote:
> > > Hi Val,
> > >
> > > AFAIK you need to add an attribute "predicate" to the author in your
> > > template
> > >
> > > <author predicate="/affiliation"
> > >         fo:font-size="&hsize3;"
> > >         fo:space-before="&hsize2space;"
> > >         fo:keep-with-next="always"/>
> > >
> > > At least this works for me to add the latest revision number on the
title
> > > page.
> > >
>
> Well, the 'predicate' attribute is normally used to
> add a square bracket XSL predicate like [@role = 'foo']
> to an element to
> modify the selection pattern.  The fact that it is
> simply appended to the element name means a value
> like '/affiliation' might work in some cases to
> select a child element.  But not in this case, since
> the affiliation is the child of author, not authorgroup.
>
> In general, the titlepage.template.xml file specifies
> a flat order for items to appear on a title page.
> Any internal structure for one of the elements
> needs to be handled by the template assigned to it.
> In this case, it is the authorgroup template that
> needs to handle its authors and affiliations.
>
> It turns out that Norm wrote a special template for
> authorgroup just for books, and it doesn't include
> affiliation.  You'll have to ask him why.  It's in
> fo/titlepage.xsl and starts with:
>
> <xsl:template match="bookinfo/authorgroup" mode="titlepage.mode"
priority="2">
>   ...
>
> But there is another more generic template that
> you might like, and you don't have to write it.
> It is in fo/titlepage.xsl and starts with:
>
> <xsl:template match="authorgroup" mode="titlepage.mode">
> ...
>
> If you copy that template to your customization layer,
> you will get a stack of authors and affiliations on
> your title page.
>
> In your customization, you should probably change the first
> line to use this mode:
>
> <xsl:template match="authorgroup" mode="book.titlepage.recto.mode">
>
> That mode means it will only be used for book recto title
> pages, and not other title pages.
>
> The title page stuff is one of the most complex parts of
> the DocBook XSL stylesheets.  I've written some doc on
> them at:
>
> http://www.sagehill.net/xml/docbookxsl/PrintCustomEx.html#TitlePagePrint
>
> It includes a listing of the sequence of templates used to
> produce a book title page.
> --
>
> Bob Stayton                                 400 Encinal Street
> Publications Architect                      Santa Cruz, CA  95060
> Technical Publications                      voice: (831) 427-7796
> Caldera International, Inc.                 fax:   (831) 429-1887
>                                             email: bobs@caldera.com
>


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