RE: matching elements only once

Subject: RE: matching elements only once
From: mxmodi@xxxxxxxxxxxxxxx
Date: Mon, 23 Oct 2000 07:52:40 -0500
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


Current Thread