This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: xsl:number - What is Numbering Context?
- From: "G. Ken Holman" <gkholman at CraneSoftwrights dot com>
- To: XSL List <xsl-list at lists dot mulberrytech dot com>
- Date: Wed, 24 Apr 2002 16:45:34 -0400
- Subject: Re: [xsl] xsl:number - What is Numbering Context?
- Reply-to: xsl-list at lists dot mulberrytech dot com
At 2002-06-24 14:37 -0500, W. Eliot Kimber 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>
BTW, the above could be shortened in your stylesheet to:
<xsl:template name="figure-caption-text">
<xsl:text/>Figure <xsl:number count="Figure" level="any"/>. <xsl:text/>
<xsl:apply-templates/>
</xsl:template>
>However, when I call it for the cross ref, I always get the value "1":
Your xref stuff looks just fine ... are you sure you are changing the
current node along the lines of:
<xsl:apply-templates select="id(@xrefptr)" mode="xref"/>
>Clearly I'm missing something.
The code you've shown seems just fine, but you don't show how you get there.
>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().
Yes, you are correct ... there is no "context" for <xsl:number/> other than
the use of the from= attribute that limits context, which you are not using.
...................... Ken
--
Upcoming: 3-days XSLT/XPath and/or 2-days XSLFO: June 17-21, 2002
- : 3-days XML Information Modeling: July 31-August 2, 2002
G. Ken Holman mailto:gkholman@CraneSoftwrights.com
Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (Fax:-0995)
ISBN 0-13-065196-6 Definitive XSLT and XPath
ISBN 1-894049-08-X Practical Transformation Using XSLT and XPath
ISBN 1-894049-07-1 Practical Formatting Using XSLFO
XSL/XML/DSSSL/SGML/OmniMark services, books(electronic, printed),
articles, training(instructor-live,Internet-live,web/CD,licensed)
Next public training: 2002-05-06,07,09,10,13,20,
- 06-04,07,10,11,13,14,17,20,07-31,08-05
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list