Re: [xsl] numbering/count()

Subject: Re: [xsl] numbering/count()
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Fri, 20 May 2005 10:14:09 -0400
Hi Bruce,

I'm not sure this bears on your question -- it might -- but in any case this strikes me as odd:

<xsl:number level="any" count="db:footnote | db:citation[not(../db:footnote)]"/>

This is numbering, together: footnotes citations that do not have footnote siblings.

Is that what you want?

If you actually want footnotes along with citations that are not *inside* footnotes, that would be

<xsl:number level="any" count="db:footnote | db:citation[not(ancestor::db:footnote)]"/>

Please forgive the intrusion if I've misconstrued what you're trying to do.

Cheers,
Wendell

At 09:12 PM 5/19/2005, you wrote:
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


======================================================================
Wendell Piez                            mailto:wapiez@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
  Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================

Current Thread