xsl-list
[Top] [All Lists]

Re: misc. confusion on "footnote" handling

2004-08-25 05:38:54
Hi Jeni,

On Aug 25, 2004, at 4:56 AM, Jeni Tennison wrote:

It's not clear whether you actually want a parameter (declared with xsl:param, set on the call with xsl:with-param) or you're using the term 'parameter' in a more descriptive way. Perhaps you want two different templates for the two different kinds of citation:

<!-- citations appearing in footnotes -->
<xsl:template match="db:footnote/db:citation">
  ...
</xsl:template>

<!-- other citations -->
<xsl:template match="db:citation">
  ...
</xsl:template>

I found it hard to explain this.  Let me try again:

Let's just take the simple case of a citation within a paragraph.

There are something like four or five different classes of citation styles.

Author-year would render the citation as (Doe, 1999)
Numbered would be like (1)

... and footnote would be, well, a footnote mark, and then the full reference would be placed in the footnote (typically instead of in a bibliography at the end)

So, I need to accommodate these vastly different classes. My thought was thus to have a global parameter called class. I just got stuck trying to understand how to handle this across different templates. So based on your examples, I'd probably want a choose option that did something like the following?

<xsl:template match="db:citation">
  <xsl:choose>
    <xsl:when test="$class='footnote'">
      <footnote>
        <xsl:apply-templates select="." mode="citation" />
      </footnote>
    </xsl:when>
    <xsl:otherwise>
      <xsl:apply-templates select="." mode="citation" />
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>

Bruce