OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: xsl:number



Hi Adnan,

XSLT questions are best address to XSL-List at
http://www.mulberrytech.com/xsl/xsl-list.

> i'm trying to set the start value number 2 with xsl:number, but it
> don't work.
> Is the syntax [<xsl:number level="any" from="2" format="1"/>] wrong.

Yes, the syntax is wrong. The from attribute needs to take a pattern -
it looks for the closest node matching that pattern and numbers nodes
starting from that one.

You have to count the nodes yourself to do that, although you can
still use xsl:number's number formatting facilities. I think you
probably need something like:

  <xsl:number value="count(preceding::foo | ancestor::foo) + 2"
              format="1" />

You should replace 'foo' with the name of the elements you're
numbering (assuming they're elements, or a node test for the nodes
you're numbering if they're not elements). Preferably you should
replace the path with something that's more specific - for example,
take out the count of ancestors unless you need to count ancestors.

Cheers,

Jeni

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