xmlns:exsl="http://exslt.org/common"
xmlns:ng="http://docbook.org/docbook-ng"
xmlns:db="http://docbook.org/ns/docbook"
- exclude-result-prefixes="db ng exsl"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ exclude-result-prefixes="db ng exsl xlink"
version='1.0'>
<!-- ********************************************************************
<!-- ==================================================================== -->
<!-- * -->
-<!-- * This stylesheet: -->
+<!-- * The templates in this file handle elements whose contents can't -->
+<!-- * be displayed completely within the main text flow in output, but -->
+<!-- * instead need to be displayed "out of line". Those elements are: -->
<!-- * -->
-<!-- * 1. Identifies all "note sources" (link, annotation, alt, and -->
-<!-- * footnote instances) in a Refentry which do not have the same -->
-<!-- * "earmark" as any preceding notesource in that same Refentry -->
-<!-- * (and for notesources that are links, then only those links -->
-<!-- * whose string value and url attribute value are not identical). -->
+<!-- * - elements providing annotative text (annotation|alt|footnote) -->
+<!-- * - elements pointing at external resources (ulink, link, and -->
+<!-- * any elements with xlink:href attributes; and imagedata, -->
+<!-- * audiodata, and videodata - which (using their fileref -->
+<!-- * attribute) reference external files -->
<!-- * -->
-<!-- * 2. Puts a number inline to mark the place where the notesource -->
-<!-- * occurs in the main text flow. -->
+<!-- * Within this stylesheet, the above are collectively referred to as -->
+<!-- * a "notesources". This stylesheet handles those notesources in -->
+<!-- * this way: -->
<!-- * -->
-<!-- * 3. Generates a numbered endnotes list (titled NOTES in -->
-<!-- * English) at the end of the man page, with the contents of -->
-<!-- * each notesourcse. -->
+<!-- * 1. Constructs a numbered in-memory index of all unique "earmarks“ -->
+<!-- * of all notesources in the document. For each link, the -->
+<!-- * earmark is the value of its url or xlink:href attribute; for -->
+<!-- * each imagedata|audiodata|videodata: the value of its fileref -->
+<!-- * attribute; for each annotative element: its content. -->
<!-- * -->
-<!-- * Note that table footnotes are not listed in the endnotes list, -->
-<!-- * and are not handled by this stylesheet (they are instead -->
-<!-- * handled by the table.xsl stylesheet). -->
+<!-- * Notesources with the same earmark are assigned the same -->
+<!-- * number. -->
<!-- * -->
-<!-- * Also, we don't get notesources in *info sections or Refmeta or -->
-<!-- * Refnamediv or Indexterm, because, in manpages output, contents -->
-<!-- * of those are either suppressed or are displayed out of document -->
-<!-- * order - for example, the Info/Author content gets moved to the -->
-<!-- * end of the page. So, if we were to number notesources in the Author -->
-<!-- * content, it would "throw off" the numbering at the beginning of -->
-<!-- * the main text flow. -->
+<!-- * By design, that index excludes any element whose whose string -->
+<!-- * value is identical to value of its url xlink:href attribute). -->
+<!-- * -->
+<!-- * 2. Puts a numbered marker inline to mark the place where the -->
+<!-- * notesource occurs in the main text flow. -->
<!-- * -->
-<!-- * Important: For any notesource whose earmark matches that of a -->
-<!-- * preceding notesource in the same Refentry, we assign it the -->
-<!-- * number of that previous notesource. -->
+<!-- * 3. Generates a numbered endnotes list (titled NOTES in English) -->
+<!-- * at the end of the man page, with the contents of each -->
+<!-- * notesource. -->
<!-- * -->
-<!-- * For links, we check to see if the link is empty OR if its -->
-<!-- * string value is identical to the value of its url attribute; if -->
-<!-- * either of those is true, we just display the value of its url -->
-<!-- * attribute (if the link itself is empty), and stop there. -->
+<!-- * Note that table footnotes are not listed in the endnotes list, -->
+<!-- * and are not handled by this stylesheet (they are instead handled -->
+<!-- * by the table.xsl stylesheet). -->
<!-- * -->
-<!-- * And for the record, one reason we don't use xsl:key to index -->
-<!-- * the notesources is that we need to get and check the sets of -->
-<!-- * notesources for uniqueness per-Refentry (not per-document). -->
+<!-- * Also, we don't get notesources in *info sections or Refmeta or -->
+<!-- * Refnamediv or Indexterm, because, in manpages output, contents of -->
+<!-- * those are either suppressed or are displayed out of document -->
+<!-- * order - for example, the Info/Author content gets moved to the -->
+<!-- * end of the page. So, if we were to number notesources in the -->
+<!-- * Author content, it would "throw off" the numbering at the -->
+<!-- * beginning of the main text flow. -->
<!-- * -->
-<!-- * FIXME: mediaobject and inlinemediaobject should also be handled -->
-<!-- * as notesources; should change most link* variable names to -->
-<!-- * notesource*; as with "repeat" URLS, alt instances that have the -->
-<!-- * same string value as preceding ones (likely to occur for repeat -->
-<!-- * acroynyms and abbreviations) should be listed only once in -->
-<!-- * the endnotes list, and numbered accordingly inline; split -->
-<!-- * man.indent.width into man.indent.width.value (default 4) and -->
-<!-- * man.indent.width.units (default n); also, if the first child of -->
-<!-- * notesource is some block content other than a (non-formal) -->
-<!-- * paragraph, the current code will probably end up generating a -->
-<!-- * blank line after the corresponding number in the endnotes -->
-<!-- * list... we should probably try to instead display the title of -->
-<!-- * that block content there (if there is one: e.g., the list title, -->
-<!-- * admonition title, etc.) -->
+<!-- * And for the record, one reason we don't use xsl:key to index the -->
+<!-- * earmarks is that we need to get and check the sets of -->
+<!-- * earmarks for uniqueness per-Refentry (not per-document). -->
<!-- * -->
+<!-- * FIXME: as -->
+<!-- * with "repeat" URLS, alt instances that have the same string value -->
+<!-- * as preceding ones (likely to occur for repeat acroynyms and -->
+<!-- * abbreviations) should be listed only once in the endnotes list, -->
+<!-- * and numbered accordingly inline; split man.indent.width into -->
+<!-- * man.indent.width.value (default 4) and man.indent.width.units -->
+<!-- * (default n); also, if the first child of notesource is some block -->
+<!-- * content other than a (non-formal) paragraph, the current code -->
+<!-- * will probably end up generating a blank line after the -->
+<!-- * corresponding number in the endnotes list... we should probably -->
+<!-- * try to instead display the title of that block content there (if -->
+<!-- * there is one: e.g., the list title, admonition title, etc.) -->
+
<!-- ==================================================================== -->
-
-<xsl:template name="get.all.links.with.unique.urls">
- <xsl:if test="$man.links.are.numbered != 0">
+
+<xsl:template name="get.all.earmark.indexes.in.current.document">
+ <!-- * Here we create a tree to hold indexes of all earmarks in -->
+ <!-- * the current document. If the current document contains -->
+ <!-- * multiple refentry instances, then this tree will contain -->
+ <!-- * multiple indexes. -->
+ <xsl:if test="$man.endnotes.are.numbered != 0">
+ <!-- * Only create earmark indexes if user wants numbered endnotes -->
<xsl:for-each select="//refentry">
- <refentry.link.set>
+ <earmark.index>
<xsl:attribute name="idref">
<xsl:value-of select="generate-id()"/>
</xsl:attribute>
<xsl:for-each
- select=".//*[self::ulink
+ select=".//*[self::*[@xlink:href]
+ or self::ulink
+ or self::imagedata
+ or self::audiodata
+ or self::videodata
or self::footnote[not(ancestor::table)]
or self::annotation
or self::alt]
- [node()
+ [(node()
+ or self::imagedata
+ or self::audiodata
+ or self::videodata
+ )
and not(ancestor::refentryinfo)
and not(ancestor::info)
and not(ancestor::docinfo)
and not(ancestor::refnamediv)
and not(ancestor::indexterm)
and not(. = @url)
+ and not(. = @xlink:href)
and not(@url =
preceding::ulink[node()
and not(ancestor::refentryinfo)
and not(ancestor::refnamediv)
and not(ancestor::indexterm)
and (generate-id(ancestor::refentry)
- = generate-id(current()))]/@url)]">
- <notesource>
- <xsl:attribute name="earmark">
- <xsl:choose>
- <xsl:when test="@url">
- <xsl:value-of select="@url"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="generate-id()"/>
- </xsl:otherwise>
- </xsl:choose>
+ = generate-id(current()))]/@url)
+ and not(@xlink:href =
+ preceding::*[@xlink:href][node()
+ and not(ancestor::refentryinfo)
+ and not(ancestor::info)
+ and not(ancestor::docinfo)
+ and not(ancestor::refmeta)
+ and not(ancestor::refnamediv)
+ and not(ancestor::indexterm)
+ and (generate-id(ancestor::refentry)
+ = generate-id(current()))]/@xlink:href)
+ and not(@fileref =
+ preceding::*[@fileref][
+ not(ancestor::refentryinfo)
+ and not(ancestor::info)
+ and not(ancestor::docinfo)
+ and not(ancestor::refmeta)
+ and not(ancestor::refnamediv)
+ and not(ancestor::indexterm)
+ and (generate-id(ancestor::refentry)
+ = generate-id(current()))]/@fileref)]">
+ <earmark>
+ <xsl:attribute name="id">
+ <xsl:value-of select="generate-id()"/>
</xsl:attribute>
+ <xsl:attribute name="number">
+ <xsl:value-of select="position()"/>
+ </xsl:attribute>
+ <xsl:if test="@url|@xlink:href|@fileref">
+ <!-- * Only add a uri attribute if the notesource is -->
+ <!-- * a link or an element that references an external -->
+ <!-- * (an imagedata, audiodata, or videodata element) -->
+ <xsl:attribute name="uri">
+ <xsl:value-of select="@url|@xlink:href|@fileref"/>
+ </xsl:attribute>
+ </xsl:if>
<xsl:copy>
<xsl:copy-of select="node()"/>
</xsl:copy>
- </notesource>
+ </earmark>
</xsl:for-each>
- </refentry.link.set>
+ </earmark.index>
</xsl:for-each>
</xsl:if>
</xsl:template>
<!-- ==================================================================== -->
-<xsl:template match="ulink|footnote[not(ancestor::table)]|annotation|alt">
- <xsl:variable name="get.all.links.with.unique.urls">
- <xsl:call-template name="get.all.links.with.unique.urls"/>
+<xsl:template match="*[@xlink:href]|ulink
+ |imagedata|audiodata|videodata
+ |footnote[not(ancestor::table)]
+ |annotation|alt">
+ <xsl:variable name="all.earmark.indexes.in.current.document.rtf">
+ <xsl:call-template name="get.all.earmark.indexes.in.current.document"/>
</xsl:variable>
- <xsl:variable name="all.links.with.unique.urls"
- select="exsl:node-set($get.all.links.with.unique.urls)"/>
- <xsl:variable name="get.links.with.unique.urls">
- <!-- * get the set of all unique notesources in the ancestor Refentry of -->
+ <xsl:variable name="all.earmark.indexes.in.current.document"
+ select="exsl:node-set($all.earmark.indexes.in.current.document.rtf)"/>
+ <xsl:variable name="all.earmarks.in.current.refentry.rtf">
+ <!-- * get the set of all earmarks for the ancestor Refentry of -->
<!-- * this notesource -->
<xsl:copy-of
- select="$all.links.with.unique.urls/refentry.link.set
- [@idref = generate-id(current()/ancestor::refentry)]/notesource"/>
+ select="$all.earmark.indexes.in.current.document/earmark.index
+ [@idref =
+ generate-id(current()/ancestor::refentry)]/earmark"/>
</xsl:variable>
- <xsl:variable name="links.with.unique.urls"
- select="exsl:node-set($get.links.with.unique.urls)"/>
- <!-- * Identify the "earmark" for this notesource -->
+ <xsl:variable name="all.earmarks.in.current.refentry"
+ select="exsl:node-set($all.earmarks.in.current.refentry.rtf)"/>
+
+ <!-- * identify the earmark for the current element -->
<xsl:variable name="earmark">
<xsl:choose>
- <xsl:when test="@url">
- <xsl:value-of select="@url"/>
+ <xsl:when test="@url|@xlink:href">
+ <xsl:value-of select="@url|@xlink:href"/>
+ </xsl:when>
+ <xsl:when test="@fileref">
+ <xsl:value-of select="@fileref"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="generate-id()"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
- <!-- * for links, $notesource is either the link contents (if the -->
- <!-- * link is non-empty) or the "earmark" URL (if the link is empty) -->
- <xsl:variable name="notesource">
+
+ <xsl:variable name="notesource.contents">
<xsl:choose>
<!-- * check to see if the element is empty or not; if it's -->
<!-- * non-empty, get the content -->
<xsl:apply-templates/>
</xsl:when>
<xsl:otherwise>
- <!-- * Otherwise this is an empty link, so we just get the -->
- <!-- * value of its URL; note that we don't number empty links -->
+ <!-- * Otherwise this is an empty link or an empty imagedata, -->
+ <!-- * audiodata, or videodata element, so we just get the -->
+ <!-- * value of its url, xlink:href, or fileref attribute. -->
<!-- * -->
<!-- * Add hyphenation suppression in URL output only if -->
<!-- * break.after.slash is also non-zero -->
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
- <xsl:if test="self::ulink">
- <xsl:choose>
- <!-- * if user wants links underlined, underline (ital) it -->
- <xsl:when test="$man.links.are.underlined != 0">
- <xsl:variable name="link.wrapper">
- <italic><xsl:value-of select="$notesource"/></italic>
- </xsl:variable>
- <xsl:apply-templates mode="italic" select="exsl:node-set($link.wrapper)"/>
- </xsl:when>
- <xsl:otherwise>
- <!-- * user doesn't want links underlined, so just display content -->
- <xsl:value-of select="$notesource"/>
- </xsl:otherwise>
- </xsl:choose>
+
+ <xsl:if test="self::ulink or self::*[@xlink:href]">
+ <!-- * This is a hyperlink, so we need to decide how to format -->
+ <!-- * the inline contents of the link (to underline or not). -->
+ <xsl:choose>
+ <!-- * if user wants links underlined, underline (ital) it -->
+ <xsl:when test="$man.links.are.underlined != 0">
+ <xsl:variable name="link.wrapper">
+ <italic><xsl:value-of select="$notesource.contents"/></italic>
+ </xsl:variable>
+ <xsl:apply-templates mode="italic"
+ select="exsl:node-set($link.wrapper)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- * user doesn't want links underlined, so just display content -->
+ <xsl:value-of select="$notesource.contents"/>
+ </xsl:otherwise>
+ </xsl:choose>
</xsl:if>
- <!-- * If link is non-empty AND its string value is not equal to the -->
- <!-- * value of its url attribute AND user wants notesources numbered, -->
- <!-- * then output a number for it -->
- <xsl:if test="node() and not(. = @url) and $man.links.are.numbered != 0">
- <!-- * We number notesources by checking the $links.with.unique.urls -->
- <!-- * set and finding the notesource whose earmark matches the -->
- <!-- * earmark for this notesource. -->
- <!-- * -->
- <!-- * If this is the only instance in this Refentry of a notesource -->
- <!-- * with this earmark, then it gets a unique number. -->
+
+ <!-- * Format the numbered marker for this notesource -->
+ <!-- * -->
+ <!-- * If this is an imagedata, audiodata, or videodata element -->
+ <!-- * OR if it's a non-empty element AND its string value is not -->
+ <!-- * equal to the value of its url or xlink:href attribute (if -->
+ <!-- * it has one) AND user wants endnotes numbered, only then -->
+ <!-- * do we output a number for it -->
+ <xsl:if test="(self::imagedata or
+ self::audiodata or
+ self::videodata or
+ (node()
+ and not(. = @url)
+ and not(. = @xlink:href))
+ )
+ and $man.endnotes.are.numbered != 0">
+ <!-- * To generate the numbered marker for this notesource, we -->
+ <!-- * check the index of all earmarks for the current refentry -->
+ <!-- * and find the number of the indexed earmark which matches -->
+ <!-- * this notesource's earmark. -->
+ <!-- * Note that multiple notesources may share the same -->
+ <!-- * numbered earmark; in that case, they get the same number. -->
<!-- * -->
- <!-- * But if this is a notesource for which there are multiple -->
- <!-- * instances of notesources in this Refentry that have the same -->
- <!-- * earmark as this notesource, then the number assigned is the -->
- <!-- * number of the _first_ instance of a notesource in this -->
- <!-- * Refentry with the earmark for this notesource (which be the -->
- <!-- * number of this notesource itself, if it happens to be the -->
- <!-- * first instance). -->
<xsl:variable name="notesource.number">
- <xsl:apply-templates
- select="$links.with.unique.urls/notesource[@earmark = $earmark][1]"
- mode="notesource.number"/>
+ <xsl:choose>
+ <xsl:when test="self::ulink or
+ self::*[@xlink:href] or
+ self::imagedata or
+ self::audiodata or
+ self::videodata">
+ <xsl:value-of select="$all.earmarks.in.current.refentry/earmark[@uri = $earmark]/@number"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$all.earmarks.in.current.refentry/earmark[@id = $earmark]/@number"/>
+ </xsl:otherwise>
+ </xsl:choose>
</xsl:variable>
+
<!-- * Format the number by placing it in square brackets. FIXME: -->
<!-- * This formatting should probably be made user-configurable, -->
<!-- * to allow something other than just square brackets; e.g., -->
<!-- ==================================================================== -->
-<xsl:template match="*" mode="notesource.number">
- <xsl:value-of select="count(preceding::*[(self::ulink
- or self::footnote[not(ancestor::table)]
- or self::annotation
- or self::alt)
- and node()
- and not(ancestor::refentryinfo)
- and not(ancestor::info)
- and not(ancestor::docinfo)
- and not(ancestor::refmeta)
- and not(ancestor::refnamediv)
- and not(ancestor::indexterm)
- and not(. = @url)
- and not(@url =
- preceding::ulink[node()
- and not(ancestor::refentryinfo)
- and not(ancestor::info)
- and not(ancestor::docinfo)
- and not(ancestor::refmeta)
- and not(ancestor::refnamediv)
- and not(ancestor::indexterm)
- and (generate-id(ancestor::refentry)
- = generate-id(current()/ancestor::refentry))]/@url)]
- [generate-id(ancestor::refentry)
- = generate-id(current()/ancestor::refentry)]) + 1"/>
-</xsl:template>
+<xsl:template name="endnotes.list">
+ <!-- We have stored earmark indexes for all refentry instances in the -->
+ <!-- current document, with the ID for each index being the same ID as -->
+ <!-- its corresponding refentry; so we now need to get the ID for the -->
+ <!-- current refentry so we can grab its corresponding earmark index -->
+ <xsl:variable name="current.refentry.id">
+ <xsl:value-of select="generate-id(.)"/>
+ </xsl:variable>
-<!-- ==================================================================== -->
+ <xsl:variable name="endnotes.rtf">
+ <xsl:variable name="all.earmark.indexes.in.current.document.rtf">
+ <xsl:call-template name="get.all.earmark.indexes.in.current.document"/>
+ </xsl:variable>
+ <xsl:variable name="all.earmark.indexes.in.current.document"
+ select="exsl:node-set($all.earmark.indexes.in.current.document.rtf)"/>
+ <xsl:copy-of
+ select="$all.earmark.indexes.in.current.document/earmark.index
+ [@idref = $current.refentry.id]/earmark"/>
+ </xsl:variable>
-<xsl:template name="endnotes.list">
- <xsl:variable name="notesources"
- select=".//*[(self::ulink
- or self::footnote[not(ancestor::table)]
- or self::annotation
- or self::alt)
- and node()
- and not(ancestor::refentryinfo)
- and not(ancestor::info)
- and not(ancestor::docinfo)
- and not(ancestor::refmeta)
- and not(ancestor::refnamediv)
- and not(ancestor::indexterm)
- and not(. = @url)
- and not(@url =
- preceding::ulink[node()
- and not(ancestor::refentryinfo)
- and not(ancestor::info)
- and not(ancestor::docinfo)
- and not(ancestor::refmeta)
- and not(ancestor::refnamediv)
- and not(ancestor::indexterm)
- and (generate-id(ancestor::refentry)
- = generate-id(current()))]/@url)]"/>
- <!-- * check to see if we have actually found any notesources; if we -->
- <!-- * have, we generate the endnotes list, if not, we do nothing -->
- <xsl:if test="$notesources/node()">
+ <xsl:variable name="endnotes" select="exsl:node-set($endnotes.rtf)"/>
+
+ <!-- * check to see if we have actually found any content to use as -->
+ <!-- * endnotes; if we have, we generate the endnotes list, if not, -->
+ <!-- * we do nothing -->
+ <xsl:if test="$endnotes/node()">
<xsl:call-template name="format.endnotes.list">
- <xsl:with-param name="notesources" select="$notesources"/>
+ <xsl:with-param name="endnotes" select="$endnotes"/>
</xsl:call-template>
</xsl:if>
+
</xsl:template>
<!-- ==================================================================== -->
<xsl:template name="format.endnotes.list">
- <xsl:param name="notesources"/>
+ <xsl:param name="endnotes"/>
<xsl:call-template name="mark.subheading"/>
- <!-- * make the endnotes-list section heading -->
+
+ <!-- * ======= make the endnotes-list section heading ============= -->
<xsl:text>⌂SH "</xsl:text>
<xsl:call-template name="string.upper">
<xsl:with-param name="string">
<xsl:choose>
<!-- * if user has specified a heading, use that -->
- <xsl:when test="$man.links.list.heading != ''">
- <xsl:value-of select="$man.links.list.heading"/>
+ <xsl:when test="$man.endnotes.list.heading != ''">
+ <xsl:value-of select="$man.endnotes.list.heading"/>
</xsl:when>
<xsl:otherwise>
<!-- * otherwise, get localized heading from gentext -->
<!-- * (in English, NOTES) -->
<xsl:call-template name="gentext">
- <xsl:with-param name="key" select="'References'"/>
+ <xsl:with-param name="key" select="'Notes'"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
</xsl:call-template>
<xsl:text>" </xsl:text>
- <xsl:for-each select="$notesources">
+
+ <!-- * ================ process each earmark ====================== -->
+ <xsl:for-each select="$endnotes/earmark">
<!-- * make paragraph with hanging indent, and starting with a -->
<!-- * number in the form " 1." (padded to $man.indent.width - 1) -->
<xsl:text>⌂IP</xsl:text>
<xsl:text> "</xsl:text>
<xsl:variable name="endnote.number">
- <xsl:apply-templates select="." mode="notesource.number"/>
+ <xsl:value-of select="@number"/>
<xsl:text>.</xsl:text>
</xsl:variable>
<xsl:call-template name="prepend-pad">
<xsl:value-of select="$list-indent"/>
</xsl:if>
<xsl:text> </xsl:text>
- <!-- * Print the endnote contents -->
- <!-- * -->
- <!-- * IMPORTANT: If there are multiple notesources in this Refentry -->
- <!-- * with the same earmark, this gets the contents of the first -->
- <!-- * instance of the notesource in this Refentry with that earmark -->
+
+ <!-- * ========================================================= -->
+ <!-- * print the notesource/endnote contents -->
+ <!-- * ========================================================= -->
<xsl:choose>
- <xsl:when test="self::ulink">
- <xsl:variable name="contents">
- <xsl:apply-templates/>
- </xsl:variable>
- <xsl:value-of select="normalize-space($contents)"/>
+ <xsl:when test="*/node()">
+ <!-- * if the earmark has non-empty child content, then -->
+ <!-- * its corresponding notesource is either a link or -->
+ <!-- * an instance of annotative text, so we want to -->
+ <!-- * display that content -->
+ <xsl:apply-templates select="*/node()"/>
</xsl:when>
<xsl:otherwise>
- <xsl:apply-templates/>
+ <!-- * otherwise, this earmark has empty content, -->
+ <!-- * which means its corresponding notesources is an -->
+ <!-- * imagedata, audiodata, or videodata instance; in -->
+ <!-- * that case, we use the value of the notesoures's -->
+ <!-- * @fileref attribute (which is stored in the -->
+ <!-- * earmark uri attribute) as the "contents" for -->
+ <!-- * this endnote/notesource -->
+ <xsl:value-of select="@uri"/>
</xsl:otherwise>
</xsl:choose>
- <xsl:text> </xsl:text>
- <xsl:if test="@url">
+ <xsl:text> </xsl:text>
+
+ <!-- * ========================================================= -->
+ <!-- * print the URL for links -->
+ <!-- * ========================================================= -->
+ <!-- * In addition to the notesource contents, if the -->
+ <!-- * notesource is a link, we display the URL for the link. -->
+ <!-- * But for notesources that are imagedata, audiodata, or -->
+ <!-- * videodata instances, we don't want to (re)display the -->
+ <!-- * URL for those here, because for those elements, the -->
+ <!-- * notesource contents are the URL (the value of the -->
+ <!-- * @fileref attribute), and we have already rendered them. -->
+ <!-- * -->
+ <!-- * We know an earmark is a link if it has non-empty child -->
+ <!-- * content and a uri attribute; so we check for that -->
+ <!-- * condition here. -->
+ <xsl:if test="*/node() and @uri">
<xsl:text>⌂RS</xsl:text>
<xsl:if test="not($list-indent = '')">
<xsl:text> </xsl:text>
<xsl:value-of select="$list-indent"/>
</xsl:if>
<xsl:text> </xsl:text>
- <!-- * This is a link, so print its URL. -->
<!-- * Add hyphenation suppression in URL output only if -->
<!-- * $break.after.slash is also non-zero -->
<xsl:if test="$man.hyphenate.urls = 0
<xsl:call-template name="suppress.hyphenation"/>
<xsl:text>▓%</xsl:text>
</xsl:if>
- <xsl:value-of select="@url"/>
+ <xsl:value-of select="@uri"/>
<xsl:text> </xsl:text>
<xsl:text>⌂RE</xsl:text>
<xsl:text> </xsl:text>
</xsl:if>
+
</xsl:for-each>
</xsl:template>
<refentry xmlns:src="http://nwalsh.com/xmlns/litprog/fragment"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- id="man.links.are.numbered">
+ id="man.endnotes.are.numbered">
<refmeta>
-<refentrytitle>man.links.are.numbered</refentrytitle>
+<refentrytitle>man.endnotes.are.numbered</refentrytitle>
<refmiscinfo role="type">boolean</refmiscinfo>
</refmeta>
<refnamediv>
-<refname>man.links.are.numbered</refname>
-<refpurpose>Number links?</refpurpose>
+<refname>man.endnotes.are.numbered</refname>
+<refpurpose>Number endnotes?</refpurpose>
</refnamediv>
<refsynopsisdiv>
-<src:fragment id='man.links.are.numbered.frag'>
-<xsl:param name="man.links.are.numbered">1</xsl:param>
+<src:fragment id='man.endnotes.are.numbered.frag'>
+<xsl:param name="man.endnotes.are.numbered">1</xsl:param>
</src:fragment>
</refsynopsisdiv>
<refsect1><title>Description</title>
-<para>If the value of <parameter>man.links.are.numbered</parameter> is
+<para>If the value of <parameter>man.endnotes.are.numbered</parameter> is
non-zero (the default), then for each non-empty<footnote>
-<para>A <quote>non-empty</quote> link is one that looks like
+<para>A “non-empty” notesource is one that looks like
this:<literallayout class="monospaced"
> <ulink url="http://docbook.sf.net/snapshot/xsl/doc/manpages/">manpages</ulink></literallayout>
-an <quote>empty link</quote> is on that looks like this:<literallayout class="monospaced"
+an “empty” notesource is on that looks like this:<literallayout class="monospaced"
> <ulink url="http://docbook.sf.net/snapshot/xsl/doc/manpages/"/></literallayout>
-</para></footnote> link:
+</para></footnote> “notesource”:
<itemizedlist>
<listitem>
- <para>a number (in square brackets) is displayed inline before the
- rendered contents of the link</para>
+ <para>a number (in square brackets) is displayed inline after the
+ rendered inline contents (if any) of the notesource</para>
</listitem>
<listitem>
- <para>the URL for the link is included in a numbered list of links
- that is generated at the end of each man page; the number for each
- links corresponds to the inline number for the link with which it is
- associated</para>
+ <para>the contents of the notesource are included in a
+ numbered list of endnotes that is generated at the end of
+ each man page; the number for each endnote corresponds to
+ the inline number for the notesource with which it is
+ associated</para>
</listitem>
</itemizedlist>
-The default heading for the list of links is
-<literal>REFERENCES</literal>. To output a different heading, set a value
+The default heading for the list of endnotes is
+<literal>NOTES</literal>. To output a different heading, set a value
for the <parameter>man.links.section.heading</parameter>
parameter.</para>
<note>
- <para>The link list is also displayed (but without numbers) if the
- value of <parameter>man.links.list.enabled</parameter> is
- non-zero.</para>
+ <para>The endnotes list is also displayed (but without
+ numbers) if the value of
+ <parameter>man.links.list.enabled</parameter> is
+ non-zero.</para>
</note>
-<para>If the value of <parameter>man.links.are.numbered</parameter> is
-zero, numbering of links is suppressed; only the link contents are
-displayed inline.
+<para>If the value of <parameter>man.endnotes.are.numbered</parameter> is
+zero, numbering of endnotess is suppressed; only inline
+contents (if any) of the notesource are displayed inline.
<important>
- <para>If you are thinking about disabling link numbering by setting
- the value of <parameter>man.links.are.numbered</parameter> to zero,
+ <para>If you are thinking about disabling endnote numbering by setting
+ the value of <parameter>man.endnotes.are.numbered</parameter> to zero,
before you do so, first take some time to carefully
consider the information needs and experiences of your users. The
- square-bracketed numbers displayed inline before links may seem
+ square-bracketed numbers displayed inline after notesources may seem
obstrusive and aesthetically unpleasing<footnote
- ><para>You might
- think that it would be better to just display URLs for non-empty
+ ><para>As far as notesources that are links, ytou might
+ think it would be better to just display URLs for non-empty
links inline, after their content, rather than displaying
square-bracketed numbers all over the place. But it's not better. In
fact, it's not even practical, because many (most) URLs for links
that, but it could be argued that what you end up with is at least
as ugly, and definitely more obstrusive, then having short
square-bracketed numbers displayed inline.</para></footnote>,
-
- but in a text-only output format, the numbered-links/link-listing
- mechanism is the only practical way of associating inline text with
- URLs.</para>
- <para>Also, users of <quote>text based</quote> browsers such as
+ but in a text-only output format, the
+ numbered-notesources/endnotes-listing mechanism is the only
+ practical way to handle this kind of content.</para>
+
+ <para>Also, users of “text based” browsers such as
<command>lynx</command> will already be accustomed to seeing inline
numbers for links. And various "man to html" applications, such as
the widely used <command><ulink
url="http://users.actrix.gen.nz/michael/vhman2html.html"
>man2html</ulink></command> (<literal>VH-Man2html</literal>)
application, can automatically turn URLs into "real" HTML hyperlinks
- in output. So leaving <parameter>man.links.are.numbered</parameter>
- at its default (non-zero) value ensures that no link information is
+ in output. So leaving <parameter>man.endnotes.are.numbered</parameter>
+ at its default (non-zero) value ensures that no information is
lost in your man-page output. It just gets
- <quote>rearranged</quote>.</para>
+ “rearranged”.</para>
</important>
</para>
<para>The handling of empty links is not affected by this
parameter. Empty links are handled simply by displaying their URLs
inline. Empty links are never auto-numbered.</para>
-<note>
- <para>Currently, this parameter only affects output for
- <tag>ulink</tag>s.</para>
-</note>
-<para>If you disable link numbering, you should probably also set
+<para>If you disable endnotes numbering, you should probably also set
<parameter>man.links.are.underlined</parameter> to zero (to disable
link underlining).</para>
</refsect1>