[xsl] xsl:number - What is Numbering Context?

Subject: [xsl] xsl:number - What is Numbering Context?
From: "W. Eliot Kimber" <eliot@xxxxxxxxxx>
Date: Mon, 24 Jun 2002 14:37:19 -0500
I am trying to number figures consecutively through a document.  I have
a named template that handles generating the display text for figure
captions. My intent is to re-use it for both the figure itself and cross
references to figures:

<xsl:template name="figure-caption-text">
  <xsl:text>Figure </xsl:text
    ><xsl:number 
          count="Figure"
          level="any"
    /><xsl:text>. </xsl:text
  ><xsl:apply-templates/>
</xsl:template>

When this template is called from the template for Figure/Caption, I get
the expected correct numbering (Figure 1, Figure 2, etc.):

<xsl:template match="Figure/Caption">
  <fo:block
      font-weight="bold">
    <xsl:call-template name="figure-caption-text"/>    
  </fo:block>
</xsl:template>

However, when I call it for the cross ref, I always get the value "1":

<xsl:template match="Figure" mode="xref">
  <xsl:apply-templates select="Caption" mode="xref"/>
</xsl:template>

<xsl:template match="Figure/Caption" mode="xref">
  <fo:inline 
      font-style="italic">
    <xsl:call-template name="figure-caption-text"/>
  </fo:inline>
</xsl:template>

Clearly I'm missing something. I didn't see anything in the spec or the
FAQ explained this behavior--everything implies that the numbering is
with respect to the source tree, not, for example, the current node list
as for position().

Thanks,

Eliot
-- 
W. Eliot Kimber, eliot@xxxxxxxxxx
Consultant, ISOGEN International

1016 La Posada Dr., Suite 240
Austin, TX  78752 Phone: 512.656.4139

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread