xsl-list
[Top] [All Lists]

apply-templates select and current() question

2005-05-18 19:42:38

I'm trying to implement citation processing where citations basically treated as if they were footnotes; rendered and numbered the same.

So I created a union template in its own mode like so, which is close to working correctly.

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

The above select statement is supposed to:

- if current() is db:citation apply-templates to itself in the default mode - if current() is db:footnote, then just do the standard apply-templates to the children

However, for the latter I end up with this:

2.  [1]

.. which tells me that even though the current() for the this element is in fact db:footnote, the select is "."

If I change the select statement to just "*", then that part gets rendered correctly.

If I change the statement to "if (../db:footnote) then * else ." then it also seems to work (there's one problem that I think is unrelated).

So what's going on??

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>