Hi there,

I have some XML data that looks like:

...
  <Entry>
    <Date>2001-10-20</Date>
    <Count>32</Count>
  </Entry>
  <Entry>
    <Date>2001-10-21</Date>
    <Count>78</Count>
  </Entry>
  <Entry>
    <Date>2001-10-22</Date>
    <Count>43</Count>
  </Entry>
  <Entry>
    <Date>2001-10-23</Date>
    <Count>3</Count>
  </Entry>
...

I've been trying to come up with an extension function that will sum all the counts over a certain date range.

My call looks something like:

<xsl:value-of select="my-ext:sumOverDays(../*, '--10-21', 1, 'Count', 'Date')"/>

My first parameter to the function passes in a NodeList with all the "Entry" nodes in it. Each "Entry" node should have 2 child nodes, "Date" and "Count". The problem is that if I say:

node_list.item(i).getChildNodes();

I get a "Not Supported Exception" because the implementation of the Node is a DTMNodeProxy and the method is defined as:

public final NodeList getChildNodes()
{
  throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);
}



So, my question is, how do I get a sum over a range of dates like this? Because my range of values is a range of dates, I can't come up with an XPath statement that returns that set of nodes and passes it to the extension function.

Can anyone enlighten me?

Ben



Reply via email to