You need to format an author, a group of authors, or any other name of persons.
The DocBook stylesheets provide the template
person.name
for a single name or
person.name.list
for a group of names. For example,
consider the following info
element:
<info> <author> <personname> <firstname>Tux</firstname> <surname>Penguin</surname> </personname> </author> </info>
To retrieve the author name, use the following code in your template:
<xsl:call-template name="person.name"> <xsl:with-param name="node" select="$theauthor"/> </xsl:call-template>
where the variable theauthor
points to
the author node. The previous template returns the expected
string:
Tux Penguin
For a group of names it is similar, just replace
person.name
with
person.name.list
.
At first glance, names seem pretty easy to format. However, it is a little bit more complicated. For example, the title of a person, its lineage, or middle names can make it sometimes harder to extract all the information. The following author contains a title and a lineage:
<author> <personname> <honorific>Dr.</honorific> <firstname>Tux</firstname> <othername>Tuxy</othername> <surname>Penguin</surname> <lineage>Jr.</lineage> </personname> </author>
Depending on what you need, the DocBook stylesheets can format the name in different ways
Template | Result |
---|---|
person.name | Dr. Tux Tuxy Penguin, Jr |
person.name.last-first | Penguin, Tux |
person.name.family-given | Penguin Tux [FAMILY Given] |
Keep in mind, the current implementation only takes into
account the first occurrence of honorific
or
lineage
.
Project@GitHub | Issue#7 |