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

apply-templates select and current() question

Subject: apply-templates select and current() question
From: "Bruce D'Arcus" <bdarcus@xxxxxxxxx>
Date: Wed, 18 May 2005 22:42:38 -0400
apply templates select
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

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.