<xsl:text> </xsl:text>
<!-- * For each attribution found, use only the first e-mail -->
<!-- * address or ulink value found -->
- <xsl:apply-templates select="(.//email|address/otheraddr/ulink)[1]"/>
+ <xsl:apply-templates select="(.//email|address/otheraddr/ulink)[1]"
+ mode="metadata.author"/>
</xsl:if>
</xsl:template>
+ <xsl:template match="email|address/otheraddr/ulink" mode="metadata.author">
+ <xsl:text><</xsl:text>
+ <xsl:choose>
+ <xsl:when test="self::email">
+ <xsl:variable name="contents">
+ <xsl:apply-templates/>
+ </xsl:variable>
+ <xsl:value-of select="normalize-space($contents)"/>
+ </xsl:when>
+ <xsl:when test="self::ulink">
+ <xsl:variable name="contents">
+ <xsl:apply-templates select="."/>
+ </xsl:variable>
+ <xsl:value-of select="normalize-space($contents)"/>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:text>></xsl:text>
+ </xsl:template>
+
<xsl:template match="corpauthor|corpcredit|orgname|publishername" mode="metadata.author">
<xsl:variable name="contents">
<xsl:apply-templates/>
<!-- ================================================================== -->
+ <!-- * The person.name template in the HTML stylesheets outputs extra -->
+ <!-- * spaces that we need to strip out for manpages output. This -->
+ <!-- * template calls person.name, then tries to do some smart -->
+ <!-- * normalization of the result tree fragment from that. -->
<xsl:template name="person.name.normalized">
<xsl:variable name="contents">
<xsl:call-template name="person.name"/>
</xsl:variable>
- <xsl:value-of select="normalize-space($contents)"/>
+ <!-- * We put the output of person.name into a node-set and then we -->
+ <!-- * check it node-by-node and strip out space only where needed. -->
+ <xsl:variable name="contents.tree" select="exsl:node-set($contents)"/>
+ <xsl:for-each select="$contents.tree/node()">
+ <xsl:choose>
+ <!-- * We don't want to monkey with single spaces or commas/periods -->
+ <!-- * followed by spaces, because those are bits of text that are -->
+ <!-- * actually generated by the person.name template itself (that -->
+ <!-- * is, they're not in the source. So, we preserve them. -->
+ <xsl:when test=". = ' ' or . = ', ' or . = '. '">
+ <xsl:value-of select="."/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="normalize-space(.)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
</xsl:template>
<!-- ================================================================== -->