The stylesheets support three different styles for rendering a person's name from a personname
element. You select the style for a given instance by adding a role
attribute to the personname
element. The styles are:
personname role attribute | Example output |
---|---|
none or role="first-last" | Bob Stayton |
role="last-first" | Stayton, Bob |
role="family-given" | Stayton Bob [FAMILY Given] |
The family-given
style commonly used in Asia adds a text label to identify the style so it will not be confused with the first-name last-name order. If you want to change the way that style is handled, you can customize the template named person.name.family-given
in common/common.xsl
as follows:
<xsl:template name="person.name.family-given"> <xsl:param name="node" select="."/> <!-- The family-given style applies a convention for identifying given --> <!-- and family names in locales where it may be ambiguous --> <xsl:apply-templates select="$node//surname[1]"/> <xsl:if test="$node//surname and $node//firstname"> <xsl:text> </xsl:text> </xsl:if> <xsl:apply-templates select="$node//firstname[1]"/> <xsl:text> [FAMILY Given]</xsl:text> </xsl:template>
The style of person names can also be globally changed for each language using the gentext locale files. For example, the English gentext file common/en.xml
has this entry which sets the English style to first-last
:
<l:context name="styles"> <l:template name="person-name" text="first-last"/> </l:context>
See the section “Generated text” for more information on customizing gentext.
If you want to change the handling of a named style or add additional person name styles, you can customize the template named person.name
in the stylesheet module common/common.xsl
.
DocBook XSL: The Complete Guide - 4th Edition | PDF version available | Copyright © 2002-2007 Sagehill Enterprises |