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

RE: position of an element

Subject: RE: position of an element
From: Sebastian Schirmer <schirmer@xxxxxxxxxxxxx>
Date: Fri, 25 May 2001 17:50:10 +0200
sebastian schirmer

-----Ursprüngliche Nachricht-----
Von: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]Im Auftrag von Michael Kay
Gesendet: Freitag, 25. Mai 2001 14:16
An: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Betreff: RE:  position of an element


>> <template match="content">
>> 	<xsl:value-of 
>> select="position-of-this-element-in-the-document()" />
>> </template>
>> 

> You can use xsl:number, or count(preceding-sibling::*)+1


Ok, xsl:number works for the little example I gave above, but in fact my XML
looks like this:

--- snip --
<xmltable>
	<row>
		<data><content key="string"></data>
		<data><content key="image"></data>
		<data><content key="string"></data>
	</row>
	<row>
		<data>
			<xmltable>
				<row>
					<data><content key="image"></data>
					<data><content key="image"></data>
					<data><content key="string"></data>
				</row>
			<xmltable>
		</data>
	</row>
</xmltable>
--- snip ---



That means if I wanted to count/number the content elements, <xsl:number
level="any" /> would output the correct result.
Now I want to count the content elements with key="string", then the ones
with key="image" etc.

I could make a <xsl:template match="content[@key = 'string']> and then
<xsl:number as shown above and it would work as well.
But I want <xsl:template match="content">, not specified with the key
attribute value. Inside this template I need the number/count of the content
elements with the specific key attribute values, for example:

"This is the third content element with key=string in the document."
"This is the fifth content element with key=image in the document."


Thanks


Sebastian Schirmer



 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.