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 April 15th, 2013, 11:04 AM
Authorized User
 
Join Date: Apr 2013
Posts: 31
Thanks: 3
Thanked 0 Times in 0 Posts
Default xslt number count

Hi i've the below xml

HTML Code:
<?xml version="1.0" encoding="UTF-8"?>
<chapter num="A">
	<title>
		<content-style font-style="bold">PART 1 GENERAL PRINCIPLES</content-style>
	</title>
	<section level="sect1">
		<title>
			<content-style font-style="bold">Chapter 1: THE NEW ARBITRATION ORDINANCE</content-style>
		</title>
		<section level="sect2">
			<title>INTRODUCTION</title>
			</section>
			<section level="sect2" num="1.">
			<title>INTRODUCTION</title>
			</section>
			<section level="sect2"  num="2.">
			<title>INTRODUCTION 1</title>
			</section>
			<section level="sect2"  num="3.">
			<title>INTRODUCTION 2</title>
			</section>
			</section>
			</chapter>

and when i use the below xslt


HTML Code:
<xsl:number count="section"/>

the number is starting from 2, but i want from 1 as, the first sec2 doesn't have a num attribute, please let me know how can i do this, also i need to use only number count function

Thanks
 
Old April 15th, 2013, 12:14 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Try xsl:number count="section[@num]"
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
The Following User Says Thank You to mhkay For This Useful Post:
sunnykeerthi (April 16th, 2013)





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to count the number of occurence of a string ? khb3283 C# 12 October 5th, 2008 11:10 PM
How to count the number of access the webpage ? khb3283 ASP.NET 2.0 Basics 2 October 2nd, 2008 09:08 PM
How to count number of parameters given in URL by alfiecrosby PHP How-To 1 April 23rd, 2008 01:57 AM
Need to Count number of lines in a file lawsoncobol Access VBA 2 July 19th, 2007 04:28 AM
Count the number of output lines joyces XSLT 7 July 6th, 2005 11:49 AM





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