[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

numbering/count()

Subject: numbering/count()
From: "Bruce D'Arcus" <bdarcus@xxxxxxxxx>
Date: Thu, 19 May 2005 21:12:58 -0400
xsl function count
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

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.