[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [docbook-apps] More than one <othername>
Well, the solution not requiring customization would be to put both names into one othername: <personname> <firstname>Elizabeth</firstname> <othername>Alexandra Mary</othername> <surname>Windsor</surname> </personname> But I admit that doesn't really follow the personname content model, with each name in its own element. The personname element is handled by a template named 'person.name' in common/common.xsl. It can produce several styles of personname based on a role attribute, calling a different template for each style. The default is first-last, so you could customize its template as follows (new code is marked by comments): <xsl:template name="person.name.first-last"> <xsl:param name="node" select="."/> <xsl:if test="$node//honorific"> <xsl:apply-templates select="$node//honorific[1]"/> <xsl:value-of select="$punct.honorific"/> </xsl:if> <xsl:if test="$node//firstname"> <xsl:if test="$node//honorific"> <xsl:text> </xsl:text> </xsl:if> <xsl:apply-templates select="$node//firstname[1]"/> </xsl:if> <xsl:if test="$node//othername and $author.othername.in.middle != 0"> <xsl:if test="$node//honorific or $node//firstname"> <xsl:text> </xsl:text> </xsl:if> <xsl:apply-templates select="$node//othername[1]"/> <!-- Start of custom code --> <xsl:for-each select="$node//othername[position() != 1]"> <xsl:text> </xsl:text> <xsl:apply-templates/> </xsl:for-each> <!-- End of custom code --> </xsl:if> <xsl:if test="$node//surname"> <xsl:if test="$node//honorific or $node//firstname or ($node//othername and $author.othername.in.middle != 0)"> <xsl:text> </xsl:text> </xsl:if> <xsl:apply-templates select="$node//surname[1]"/> </xsl:if> <xsl:if test="$node//lineage"> <xsl:text>, </xsl:text> <xsl:apply-templates select="$node//lineage[1]"/> </xsl:if> </xsl:template> Note: to get <othername> to appear at all, the parameter 'author.othername.in.middle' has to be set to 1 (which is the default). Bob Stayton Sagehill Enterprises DocBook Consulting bobs@sagehill.net ----- Original Message ----- From: "Dalan Hurst" <d@webbscreek.us> To: <docbook-apps@lists.oasis-open.org> Sent: Wednesday, August 31, 2005 4:59 PM Subject: [docbook-apps] More than one <othername> > I've tried a few ways to get the stylesheets to process two othernames in a > personname: > > #1 > <personname> > <firstname>Elizabeth</firstname> > <othername>Alexandra</othername> > <othername>Mary</othername> > <surname>Windsor</surname> > </personname> > > #2 > <personname> > Elizabeth Alexandra Mary Windsor > </personname> > > #3 > <personname> > <firstname>Elizabeth</firstname> > <othername role="middle">Alexandra</othername> > <othername role="middle">Mary</othername> > <surname>Windsor</surname> > </personname> > > But none seem to work (with #1 and #3 the stylesheets produce "Elizabeth > Alexandra Windsor", #2 doesn't show up at all). I've even tried a customization > layer that looks something like: > > <xsl:template match="personname"> > <xsl:apply-templates select="firstname" /> > <xsl:apply-templates select="othername" /> > <xsl:apply-templates select="surname" /> > </xsl:template> > > But I don't put much stock yet in my XSL-fu, so I wasn't surprised when that > didn't work. Anyone have an idea? > > Thanks (and special thanks to Norm and Mauritz for responding to my earlier > questions), > d > > --------------------------------------------------------------------- > To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org > For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org > > >
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]