473,405 Members | 2,141 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

More Help Counting

Hi,
I am in need of help trying to count the number of records that a Key
group contains. I am a newbie and apologise if this seems a dumb
request!

I have the following XSLT and keep getting zero returned.

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- Define keys used to group elements -->
<xsl:key name="keyContactGUID" match="result"
use="objectid.contactid"/>
<xsl:template match="/">
<!-- autonumber for the sorting id column -->
<html>
<body>
<h2>Grouping Test</h2>

<table border="1">
<tr bgcolor="#9acd32">
<th>Contact</th>
<th># of Visits</th>
<th>Account</th>
</tr>
<xsl:variable name="CC"
select="count(key('keyContactGUID',objectid.contac tid))"/>
<!-- Process each Contact-->
<xsl:for-each select="//result[generate-id(.) =
generate-id(key('keyContactGUID',objectid.contactid)[1])]">

<tr>
<xsl:variable name="CID">
<xsl:value-of select="objectid.contactid"/>
</xsl:variable>
<td>
<xsl:value-of select="objectid.fullname"/>
<p/>
</td>
<td>
<xsl:value-of
select="count(key('keyContactGUID',objectid.contac tid)/activityid)"/>
</td>
<td>
<xsl:value-of select="objectid.accountid/@name"/>
</td>
</tr>

</xsl:for-each>
</table>
<xsl:variable name="CC"
select="count(key('keyContactGUID',objectid.contac tid))"/>
Count = <xsl:value-of select="$CC"/>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

Thanks in advance
Graham.
Jul 20 '05 #1
2 1298
Graham wrote:
I am in need of help trying to count the number of records that a Key
group contains. I am a newbie and apologise if this seems a dumb
request!

I have the following XSLT and keep getting zero returned.


Well, you forgot to provide a sample input XML.

--
Oleg Tkachenko [XML MVP]
http://blog.tkachenko.com
Jul 20 '05 #2
Graham wrote:

<xsl:template match="/">
<!-- autonumber for the sorting id column -->
<html>
<body>
As you can see here context node is root. There is no objectid.contactid
element in this context.
<xsl:variable name="CC"
select="count(key('keyContactGUID',objectid.contac tid))"/>
Count = <xsl:value-of select="$CC"/>


I'm not sure which count you need, but try somethng like
<xsl:variable name="CC"
select="count(key('keyContactGUID',//result/objectid.contactid))"/>

--
Oleg Tkachenko [XML MVP]
http://blog.tkachenko.com
Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

303
by: mike420 | last post by:
In the context of LATEX, some Pythonista asked what the big successes of Lisp were. I think there were at least three *big* successes. a. orbitz.com web site uses Lisp for algorithms, etc. b....
6
by: Elbert Lev | last post by:
Please correct me if I'm wrong. Python (as I understand) uses reference counting to determine when to delete the object. As soon as the object goes out of the scope it is deleted. Python does...
1
by: Tony Johansson | last post by:
Hello Experts! I reading a book called programming with design pattern revealed by Tomasz Muldner and here I read something that I don't understand completely. It says "A garbarage...
1
by: Tony Johansson | last post by:
Hello Experts! I reading a book called programming with design pattern revealed by Tomasz Muldner and here I read something that I don't understand completely. It says "A garbarage...
18
by: ChadDiesel | last post by:
I appreciate the help on this group. I know I've posted a lot here the last couple of weeks, but I was thrown into a database project at my work with very little Access experience. No other...
1
by: j | last post by:
Hi, I've been trying to do line/character counts on documents that are being uploaded. As well as the "counting" I also have to remove certain sections from the file. So, firstly I was working...
4
by: aaronfude | last post by:
Hi, Please consider the following class (it's not really my class, but it's a good example for my question): class Vector { int myN; double *myX; Vector(int n) : myN(n), myX(new double) { }...
1
by: oec.deepak | last post by:
Hi Cn any one telll me what is Reference counting in C++.
82
by: Bill David | last post by:
SUBJECT: How to make this program more efficient? In my program, a thread will check update from server periodically and generate a stl::map for other part of this program to read data from....
3
by: nitric | last post by:
hey guys, i'm really stuck on this program. It's basically a survey and I have to ask people what drinks they like. 1-4, coffee tea oj and lemonade. i'm having trouble counting the TOTAL NUMBER...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.