|
Subject: Re: [xsl] misc. confusion on "footnote" handling From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx> Date: Wed, 25 Aug 2004 09:56:35 +0100 |
Hi Bruce,
> I want a parameter -- called citation-class -- where one option is
> author-year (what I've been working on), and another is "footnote."
>
> When the parameter is set to footnote, all citations get treated as
> if they were a footnote (e.g. they become footnoted on output),
> unless they are already in a footnote, in which case they just get
> rendered.
>
> I'm thinking I need to be doing something like this:
>
> <xsl:template match="db:footnote|db:citation">
> <xsl:choose>
> <xsl:when test="$class='footnote'">
> ...
> </xsl:when>
> <xsl:otherwise>
> ...
> </xsl:otherwise>
> </xsl:choose>
> </xsl:template>
>
> But I'm not sure quite what to do next, or b) if there a better way
> to do this? Maybe somehow using modes?
I'm not sure from your description what you're trying to do (what
output you're trying to achieve). 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>
These could both 'call' the same code where they needed the same
processing (whether by actually calling a template by name or by
applying templates to the <citation> element using a different mode).
For example:
<!-- citations appearing in footnotes -->
<xsl:template match="db:footnote/db:citation">
<xsl:apply-templates select="." mode="citation" />
</xsl:template>
<!-- other citations -->
<xsl:template match="db:citation">
<footnote>
<xsl:apply-templates select="." mode="citation" />
</footnote>
</xsl:template>
<xsl:template match="db:citation" mode="citation">
...
</xsl:template>
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| [xsl] misc. confusion on "footnote", Bruce D'Arcus | Thread | Re: [xsl] misc. confusion on "footn, Bruce D'Arcus |
| RE: [xsl] XSLT 2.0 book in print, Michael Kay | Date | Re: [xsl] Adding a Namespace to the, David Carlisle |
| Month |