t:person-name
t:person-name — Formats a personal name.
Synopsis
<xsl:template name="t:person-name">
<xsl:param name="style" as="xs:string"/>
</xsl:template>
Description
This template formats a personal name according to the specified style.
This template must only be called when the current context item is a
personname
. The personname
element can be used
in two different ways, it can just contain the name:
<personname>Norman Walsh</personname>
or it can contain the name with markup:
<personname><givenname>Norman</givenname>
<surname>Walsh</surname></personname>
How the name is formatted depends on which form of markup is used and which style is selected. Several styles are supported:
If the name contains no markup, it is simply formatted as is.
If the style is “
FAMILY-given
”, it is formatted witht:person-name-family-given
and generally produces the family name in upper case followed by the given name. For example: “WALSH Norman”.If the style is “
last-first
”, it is formatted witht:person-name-last-first
and generally produces the family name followed by the given name separated by a comma. For example: “Walsh, Norman”.If the style is “
first-last
”, it is formatted witht:person-name-first-last
and generally produces the given name followed by the family name. For example: “Norman Walsh”.Any other value raises
dbe:INVALID-NAME-STYLE
.
Historically, DocBook used firstname
for the given name of a person.
In DocBook 5.1, the givenname
element was introduced as an
alternative. The stylesheets treat them identically.
The stylesheets attempt to determine what style to use for each
personname
:
First, by looking at that the
role
attribute on that element. If any of styles from the$v:personal-name-styles
list appear in the role, that style will be selected. (If more than one style appears, the results are undefined.)If the
personname
doesn’t identify a style, and if it’s a child ofauthor
,editor
, orothercredit
, therole
attirbute of its parent is inspected.If the
$personal-name-style
is defined, it is is selected.If a style still hasn’t been selected the style in the localization file is used.
Personal names are notoriously complicated (see Names). DocBook includes several tags for identifying parts of names:
firstname
orgivenname
for a given name,
surname
for a family name,
lineage
for lineage (such as “Jr” or “III”),
honorific
for an honorific title (such as “Dr” or “Ms”), and
othername
for everything else.
In all likelihood, if your document contains a variety of personal names, you will need to use roles to disambiguate special cases and you will have to provide alternate or additional templates to format them.