This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: matching elements only once
- To: xsl-list at mulberrytech dot com
- Subject: RE: matching elements only once
- From: mxmodi at duke-energy dot com
- Date: Mon, 23 Oct 2000 07:52:40 -0500
- Reply-To: xsl-list at mulberrytech dot com
Hi I am trying to count the number of times the <TimeSheet> element appears
in the following XML. The code for the variable I have defined is shown
after that.
However, I only get a value of 0 always suggesting that it is considering it empty. Am I missing something.?
Thanks.
XML file:
<Employees>
<Employee>
<EmpName>some name</EmpName>
<EmpUserId>someid</EmpUserId>
<TimeSheets>
<TimeSheet>
<BeginWeek>10/01/2000</BeginWeek>
<EndWeek>10/07/2000</EndWeek>
<WeeklyTotal>40</WeeklyTotal>
</TimeSheet>
<TimeSheet>
<BeginWeek>10/08/2000</BeginWeek>
<EndWeek>10/14/2000</EndWeek>
<WeeklyTotal>40</WeeklyTotal>
</TimeSheet>
</TimeSheets>
</Employee>
<Employee>
<EmpName>employee 2</EmpName>
<EmpUserId>someid-2</EmpUserId>
<TimeSheets>
<TimeSheet>
<BeginWeek>10/01/2000</BeginWeek>
<EndWeek>10/07/2000</EndWeek>
<WeeklyTotal>40</WeeklyTotal>
</TimeSheet>
<TimeSheet>
<BeginWeek>10/08/2000</BeginWeek>
<EndWeek>10/14/2000</EndWeek>
<WeeklyTotal>40</WeeklyTotal>
</TimeSheet>
</TimeSheets>
</Employee>
</Employees>
XSL file:
<xsl:variable name="weektotal">
<xsl:value-of select="count(descendant::TimeSheet[not(child::*)])"/>
</xsl:variable>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list