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

Subject: Re: [xsl] xsl:number - What is Numbering Context?
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Wed, 24 Apr 2002 17:09:31 -0400
Eliot,

You are correct about how <xsl:number/> is specified, and your approach is sound.

I believe I've made this work just as you're doing, and nothing wrong jumps out of your code. Which processor(s) are you using and have you tried it with more than one? It does look as though somehow the context node is being lost in the xref case.

Cheers,
Wendell

At 03:37 PM 6/24/2002, you wrote:
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().


======================================================================
Wendell Piez                            mailto:wapiez@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
  Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================


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



Current Thread