Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 19th, 2003, 05:47 AM
Registered User
 
Join Date: Sep 2003
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default xsl:number

Hi,

I want to insert an attribute 'id' into all the instances of
the same element type within a document. I've been trying to
set the value using the <xsl:number> element. How can one specify
an offset so that the sequence runs (offset + 1), (offset + 2)...
instead of 1,2,3,4,5.... I've been using the count="" attribute
to specify which elements to include in the sequence.

Cheers

 
Old September 19th, 2003, 06:44 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

Can't you do that using the value attribute? e.g. <xsl:number value="3000+position()"/> where 3000 is the offset.
 
Old September 19th, 2003, 08:22 AM
Registered User
 
Join Date: Sep 2003
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hmm I don't think so. The position() return the position of the
node in relation to its siblings.

For my problem, the elements are not all under the same parent,
therefore that method could prouce instances with the same
attribute values.

 
Old October 7th, 2003, 08:32 PM
Authorized User
 
Join Date: Oct 2003
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default

It sounds like the value attribute will still work, but may need to be something different than just "position()" as you've indicated. For example, it could contain your "count" function... Maybe give us an example?

...sam





Similar Threads
Thread Thread Starter Forum Replies Last Post
line number in xml using xsl and html link mrame XSLT 3 June 17th, 2008 01:36 PM
how to assign fo:page-number to a xsl:variable or jyotsnag XSLT 0 March 14th, 2006 01:49 AM
use of xsl:number alleycat XSLT 4 February 27th, 2006 04:21 AM
help in xsl getting row number pandian XSLT 6 January 23rd, 2006 10:00 AM
XSL Transform with xsl string NOT xsl file skin XSLT 0 June 16th, 2003 07:30 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.