title: XSLT to count number of rows matching a field, within each month
body: <p>My XML is like following:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;Rowsets DateCreated="2012-08-01T17:43:31" EndDate="2012-08-01T17:43:03" StartDate="2012-08-01T16:43:03" Version="12.0.12 Build(9)"&gt;
  &lt;Rowset&gt;
      &lt;Columns&gt;
          &lt;Column Description="FirstName" MaxRange="1" MinRange="0" Name="Plant" SQLDataType="12" SourceColumn="Plant"/&gt;
          &lt;Column Description="Lastname" MaxRange="1" MinRange="0" Name="Process" SQLDataType="12" SourceColumn="Process"/&gt;
          &lt;Column Description="BorninMonth" MaxRange="1" MinRange="0" Name="ScheduleStartTimestamp" SQLDataType="93" SourceColumn="ScheduleStartTimestamp"/&gt;
          &lt;Column Description="BorninWeek" MaxRange="1" MinRange="0" Name="PO" SQLDataType="4" SourceColumn="PO"/&gt;
          &lt;Column Description="Phone" MaxRange="1" MinRange="0" Name="EquipmentName" SQLDataType="-1" SourceColumn="EquipmentName"/&gt;
      &lt;/Columns&gt;
      &lt;Row&gt;
          &lt;FirstName&gt;Derek&lt;/FirstName&gt;
          &lt;Lastname&gt;Shah&lt;/Lastname&gt;
          &lt;BorninMonth&gt;1&lt;/BorninMonth&gt;
          &lt;BorninWeek&gt;1&lt;/BorninWeek&gt;
          &lt;Phone&gt;925&lt;/Phone&gt;
      &lt;/Row&gt;
      &lt;Row&gt;
          &lt;FirstName&gt;Michael&lt;/FirstName&gt;
          &lt;Lastname&gt;Shah&lt;/Lastname&gt;
          &lt;BorninMonth&gt;1&lt;/BorninMonth&gt;
          &lt;BorninWeek&gt;2&lt;/BorninWeek&gt;
          &lt;Phone&gt;925&lt;/Phone&gt;
      &lt;/Row&gt;
      &lt;Row&gt;
          &lt;FirstName&gt;Yang&lt;/FirstName&gt;
          &lt;Lastname&gt;Patel&lt;/Lastname&gt;
          &lt;BorninMonth&gt;1&lt;/BorninMonth&gt;
          &lt;BorninWeek&gt;1&lt;/BorninWeek&gt;
          &lt;Phone&gt;925&lt;/Phone&gt;
      &lt;/Row&gt;
      &lt;Row&gt;
          &lt;FirstName&gt;Bruke&lt;/FirstName&gt;
          &lt;Lastname&gt;Shah&lt;/Lastname&gt;
          &lt;BorninMonth&gt;1&lt;/BorninMonth&gt;
          &lt;BorninWeek&gt;1&lt;/BorninWeek&gt;
          &lt;Phone&gt;925&lt;/Phone&gt;
      &lt;/Row&gt;
      &lt;Row&gt;
          &lt;FirstName&gt;Maulik&lt;/FirstName&gt;
          &lt;Lastname&gt;Shah&lt;/Lastname&gt;
          &lt;BorninMonth&gt;2&lt;/BorninMonth&gt;
          &lt;BorninWeek&gt;2&lt;/BorninWeek&gt;
          &lt;Phone&gt;925&lt;/Phone&gt;
      &lt;/Row&gt;
      &lt;Row&gt;
          &lt;FirstName&gt;Montu&lt;/FirstName&gt;
          &lt;Lastname&gt;Shah&lt;/Lastname&gt;
          &lt;BorninMonth&gt;3&lt;/BorninMonth&gt;
          &lt;BorninWeek&gt;1&lt;/BorninWeek&gt;
          &lt;Phone&gt;925&lt;/Phone&gt;
      &lt;/Row&gt;
      &lt;Row&gt;
          &lt;FirstName&gt;CHintu&lt;/FirstName&gt;
          &lt;Lastname&gt;Shah&lt;/Lastname&gt;
          &lt;BorninMonth&gt;4&lt;/BorninMonth&gt;
          &lt;BorninWeek&gt;1&lt;/BorninWeek&gt;
          &lt;Phone&gt;925&lt;/Phone&gt;
      &lt;/Row&gt;
      &lt;Row&gt;
          &lt;FirstName&gt;Pintu&lt;/FirstName&gt;
          &lt;Lastname&gt;Shah&lt;/Lastname&gt;
          &lt;BorninMonth&gt;4&lt;/BorninMonth&gt;
          &lt;BorninWeek&gt;1&lt;/BorninWeek&gt;
          &lt;Phone&gt;925&lt;/Phone&gt;
      &lt;/Row&gt;
      &lt;Row&gt;
          &lt;FirstName&gt;Puppy&lt;/FirstName&gt;
          &lt;Lastname&gt;Patel&lt;/Lastname&gt;
          &lt;BorninMonth&gt;4&lt;/BorninMonth&gt;
          &lt;BorninWeek&gt;1&lt;/BorninWeek&gt;
          &lt;Phone&gt;925&lt;/Phone&gt;
      &lt;/Row&gt;
      &lt;Row&gt;
          &lt;FirstName&gt;Tommy&lt;/FirstName&gt;
          &lt;Lastname&gt;Shah&lt;/Lastname&gt;
          &lt;BorninMonth&gt;5&lt;/BorninMonth&gt;
          &lt;BorninWeek&gt;1&lt;/BorninWeek&gt;
          &lt;Phone&gt;925&lt;/Phone&gt;
      &lt;/Row&gt;
  &lt;/Rowset&gt;
  </code></pre>
  
  <p></p>
  
  <p>Now I want to find out the count of  born in month 1 and with last name Shah. Same way Born in Month 2 and last name Shah. Born in Month 3 and Last Name Shah.</p>
  
  <p>So my output XML will look like:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;Rowsets DateCreated="2012-08-01T17:43:31" EndDate="2012-08-01T17:43:03" StartDate="2012-08-01T16:43:03" Version="12.0.12 Build(9)"&gt;
  &lt;Rowset&gt;
      &lt;Columns&gt;
          &lt;Column Description="FirstName" MaxRange="1" MinRange="0" Name="Plant" SQLDataType="12" SourceColumn="Plant"/&gt;
          &lt;Column Description="Lastname" MaxRange="1" MinRange="0" Name="Process" SQLDataType="12" SourceColumn="Process"/&gt;
          &lt;Column Description="BorninMonth" MaxRange="1" MinRange="0" Name="ScheduleStartTimestamp" SQLDataType="93" SourceColumn="ScheduleStartTimestamp"/&gt;
          &lt;Column Description="BorninWeek" MaxRange="1" MinRange="0" Name="PO" SQLDataType="4" SourceColumn="PO"/&gt;
          &lt;Column Description="Phone" MaxRange="1" MinRange="0" Name="EquipmentName" SQLDataType="-1" SourceColumn="EquipmentName"/&gt;
      &lt;/Columns&gt;
      &lt;Row&gt;
          &lt;FirstName&gt;Derek&lt;/FirstName&gt;
          &lt;Lastname&gt;Shah&lt;/Lastname&gt;
          &lt;BorninMonth&gt;1&lt;/BorninMonth&gt;
          &lt;BorninWeek&gt;1&lt;/BorninWeek&gt;
          &lt;Phone&gt;925&lt;/Phone&gt;
          &lt;CountMonth&gt;3&lt;/CountMonth&gt;
      &lt;/Row&gt;
      &lt;Row&gt;
          &lt;FirstName&gt;Michael&lt;/FirstName&gt;
          &lt;Lastname&gt;Shah&lt;/Lastname&gt;
          &lt;BorninMonth&gt;1&lt;/BorninMonth&gt;
          &lt;BorninWeek&gt;2&lt;/BorninWeek&gt;
          &lt;Phone&gt;925&lt;/Phone&gt;
          &lt;CountMonth&gt;3&lt;/CountMonth&gt;
      &lt;/Row&gt;
      &lt;Row&gt;
          &lt;FirstName&gt;Yang&lt;/FirstName&gt;
          &lt;Lastname&gt;Patel&lt;/Lastname&gt;
          &lt;BorninMonth&gt;1&lt;/BorninMonth&gt;
          &lt;BorninWeek&gt;1&lt;/BorninWeek&gt;
          &lt;Phone&gt;925&lt;/Phone&gt;
          &lt;CountMonth&gt;3&lt;/CountMonth&gt;
      &lt;/Row&gt;
      &lt;Row&gt;
          &lt;FirstName&gt;Bruke&lt;/FirstName&gt;
          &lt;Lastname&gt;Shah&lt;/Lastname&gt;
          &lt;BorninMonth&gt;1&lt;/BorninMonth&gt;
          &lt;BorninWeek&gt;1&lt;/BorninWeek&gt;
          &lt;Phone&gt;925&lt;/Phone&gt;
          &lt;CountMonth&gt;3&lt;/CountMonth&gt;
      &lt;/Row&gt;
      &lt;Row&gt;
          &lt;FirstName&gt;Maulik&lt;/FirstName&gt;
          &lt;Lastname&gt;Shah&lt;/Lastname&gt;
          &lt;BorninMonth&gt;2&lt;/BorninMonth&gt;
          &lt;BorninWeek&gt;2&lt;/BorninWeek&gt;
          &lt;Phone&gt;925&lt;/Phone&gt;
          &lt;CountMonth&gt;1&lt;/CountMonth&gt;
      &lt;/Row&gt;
      &lt;Row&gt;
          &lt;FirstName&gt;Montu&lt;/FirstName&gt;
          &lt;Lastname&gt;Shah&lt;/Lastname&gt;
          &lt;BorninMonth&gt;3&lt;/BorninMonth&gt;
          &lt;BorninWeek&gt;1&lt;/BorninWeek&gt;
          &lt;Phone&gt;925&lt;/Phone&gt;
          &lt;CountMonth&gt;1&lt;/CountMonth&gt;
      &lt;/Row&gt;
      &lt;Row&gt;
          &lt;FirstName&gt;CHintu&lt;/FirstName&gt;
          &lt;Lastname&gt;Shah&lt;/Lastname&gt;
          &lt;BorninMonth&gt;4&lt;/BorninMonth&gt;
          &lt;BorninWeek&gt;1&lt;/BorninWeek&gt;
          &lt;Phone&gt;925&lt;/Phone&gt;
          &lt;CountMonth&gt;2&lt;/CountMonth&gt;
      &lt;/Row&gt;
      &lt;Row&gt;
          &lt;FirstName&gt;Pintu&lt;/FirstName&gt;
          &lt;Lastname&gt;Shah&lt;/Lastname&gt;
          &lt;BorninMonth&gt;4&lt;/BorninMonth&gt;
          &lt;BorninWeek&gt;1&lt;/BorninWeek&gt;
          &lt;Phone&gt;925&lt;/Phone&gt;
          &lt;CountMonth&gt;2&lt;/CountMonth&gt;
      &lt;/Row&gt;
      &lt;Row&gt;
          &lt;FirstName&gt;Puppy&lt;/FirstName&gt;
          &lt;Lastname&gt;Patel&lt;/Lastname&gt;
          &lt;BorninMonth&gt;4&lt;/BorninMonth&gt;
          &lt;BorninWeek&gt;1&lt;/BorninWeek&gt;
          &lt;Phone&gt;925&lt;/Phone&gt;
          &lt;CountMonth&gt;2&lt;/CountMonth&gt;
      &lt;/Row&gt;
      &lt;Row&gt;
          &lt;FirstName&gt;Tommy&lt;/FirstName&gt;
          &lt;Lastname&gt;Shah&lt;/Lastname&gt;
          &lt;BorninMonth&gt;5&lt;/BorninMonth&gt;
          &lt;BorninWeek&gt;1&lt;/BorninWeek&gt;
          &lt;Phone&gt;925&lt;/Phone&gt;
          &lt;CountMonth&gt;1&lt;/CountMonth&gt;
      &lt;/Row&gt;
  &lt;/Rowset&gt;
  </code></pre>
  
  <p></p>
  
  <p>So I need some help in writing such XML which increments the value of Month and counts number of rows.</p>