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

RE: using only xpath string to count list items

Subject: RE: using only xpath string to count list items
From: "Arun Sinha" <arunsinha666@xxxxxxxxxxx>
Date: Fri, 19 Nov 2004 04:32:51 +0000
xsl count items
Hi Deb

Hello,

I am working with a styling tool where I am only using an xpath string
to generate text. I have the following xml where I want to know the
l1items in a task. So if I am at the first l1item in the first subtask I
can get back a count of two. I have been trying to use something along
the lines of

count(./preceding::l1item[./ancestor::task])+1

but don't know how to get to the current l1item node and figure out
where it is located in the task. The tool doesn't support current() so
any help doing this with an XPath string would be great.



I am not sure whether it is going to help you or not.
But give it a go and see this what you want.

<xsl:template match="/task/topic">
<xsl:apply-templates select="subtask" />
</xsl:template>
<xsl:template match="subtask">
<xsl:text>Subtask position = </xsl:text><xsl:value-of select="position()" /><br />
<xsl:text>llitem count = </xsl:text><xsl:value-of select="count(list1/l1item)" /><br />
<xsl:for-each select="list1/l1item">
<xsl:text>llitem position in subtask = </xsl:text><xsl:value-of select="position()" /><br />
</xsl:for-each>
</xsl:template>


Cheers.

Arun

_________________________________________________________________
NRIs - Free money transfer to India. Fly to India for free! http://acm.bridgeovertw.com/hdfc/qr/landingpage/sep04/index.htm?sitecode=610|394 Apply Now.


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.