This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: xsl:number - What is Numbering Context?


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@mulberrytech.com
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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]