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

Re: problem with xsl:number

Subject: Re: problem with xsl:number
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Wed, 27 Mar 2002 13:28:44 +0000
xsl template match li
Hi Bryan,

> <xsl:number> would give  you the position of the element in the source
> tree. Try giving a node value to the count attribute..
> <xsl:number count = "node you wana count"/>
>  thanks I'll try that.
> althought I thought as a default it counted the current node?

It does - more importantly, by default it counts at a level of
'single', so it gives you the position of the current node amongst
other nodes of that type (and name) in the same parent. So if you
have:

  <ol>
    <li>option 1</li>
    <li>option 2</li>
    ...
  </ol>

and then match li elements and number them:

<xsl:template match="li">
  <xsl:number format="1. " />
  <xsl:value-of select="." />
</xsl:template>

then you get the correct numbering of 1 through to however many items
there are in the list.

You seem to want to number images across the *entire document* rather
than within the parent element. If so, you should use the level
attributeof xsl:number with a value of 'any', to say that you want to
count the image amongst other images in the document rather than just
its parent:

<xsl:template match="image">
  <xsl:number level="any" />
  ...
</xsl:template>

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


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


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.