xsl-list
[Top] [All Lists]

numbering/count()

2005-05-19 18:12:58
I have a followup to the message from yesterday, and an exchange with Mike Kay a couple of weeks ago.

I need to create footnoted-citations, in which citations get formatted exactly like footnotes. This includes their counting.

So, I have the list mode working correctly (as in, correctly numbered) with this template:

<xsl:template match="db:footnote | db:citation[not(../db:footnote)]" mode="footcite-list">
    <xsl:variable name="number">
<xsl:number level="any" count="db:footnote | db:citation[not(../db:footnote)]"/>
    </xsl:variable>
    <p id="fn{$number}">
      <a href="#fnm{$number}" class="footnote-anchor">
        <xsl:value-of select="$number"/>
      </a>
      <xsl:text>. &#xa0;</xsl:text>
<xsl:apply-templates select="if (self::db:footnote) then * else ." mode="footcite-entry"/>
    </p>
  </xsl:template>

However, I can't get numbering to work correctly on the actual in-text footnote/citation marks.

I have two templates.  This:

  <xsl:template match="db:footnote">
    <xsl:variable name="footnote-number">
      <xsl:choose>
<xsl:when test="$citeclass='note-bib' or $citeclass='note-nobib'"> <xsl:number level="any" count="db:footnote | db:citation[not(../db:footnote)]"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="db:number-footnote(.)"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:variable>
    <xsl:text>[</xsl:text>
<a href="#fn{$footnote-number}" name="fnm{$footnote-number}" class="footnote-mark">
      <xsl:value-of select="$footnote-number"/>
    </a>
    <xsl:text>]</xsl:text>
  </xsl:template>

... and this:

        <xsl:template match="db:citation">
          <xsl:choose>
            <xsl:when test="$citeclass='note-bib' or $citeclass='note-nobib'">
              <xsl:variable name="footnote-number">
<xsl:number level="any" count="db:footnote | db:citation[not(../db:footnote)]"/>
              </xsl:variable>
              <xsl:text>[</xsl:text>
<a href="#fn{$footnote-number}" name="fnm{$footnote-number}" class="footnote-mark">
                <xsl:value-of select="$footnote-number"/>
              </a>
              <xsl:text>]</xsl:text>
            </xsl:when>
            <xsl:otherwise>
              <xsl:call-template name="bib:format-citation">
                <xsl:with-param name="output-format" select="'xhtml'"/>
              </xsl:call-template>
            </xsl:otherwise>
          </xsl:choose>
        </xsl:template>

The problem is that I get this output, where the first is a citation and the second a footnote.

A citation with page number detail: [1].
Some more citations: [1]. And now, a citation [2].

So they seem to be counted independently.

Is there some way I can get this to work right, preferably where the number is calculated in a function? I already have this function, and would like to have one called bib:number-footcite:

  <xsl:function name="db:number-footnote" as="xs:string">
    <xsl:param name="footnote" as="element(db:footnote)"/>
    <xsl:choose>
      <xsl:when test="$chapters/db:chapter">
        <xsl:number level="any" select="$footnote" from="db:chapter"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:number level="any" select="$footnote"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:function>

Bruce


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>