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

Proper syntax for counting all prior nodes in XPath?

Subject: Proper syntax for counting all prior nodes in XPath?
From: Jason Morris <jason.morris@xxxxxxxxxxxxxx>
Date: Mon, 11 Jun 2001 11:16:17 -0600
xpath count syntax
Hi,

With an XML document like this:
<DOC>
	<CHAPTER>
		<SECTION>
			<PAGE>
				<LINE>Test</LINE>
				<LINE>Test 2</LINE>
			</PAGE>
		</SECTION>
		<SECTION>
			<PAGE>
				<LINE>Test 3</LINE>
			</PAGE>
		</SECTION>
	</CHAPTER>
</DOC>

How can my XSL count all the preceding nodes?  For example, when my template
is processing the <LINE>Test 3</LINE>, I want to count all nodes before it,
which would be 2 <LINE>s, 2 <PAGE>s, 2 <SECTION>s, 1 <CHAPTER>, and 1 <DOC>.
Does this make sense?

It would be something like <xsl:number level="any"
count="DOC|CHAPTER|SECTION|PAGE|LINE"/>, except I want to use the count in
an <xsl:if />, not just display it.  I have tried using <xsl:if
test="count(something)">, but I do not know what the proper "something" is.
Any suggestions?

Thanks
Jason

 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.