|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: sum of the evaluated values
> i have xml: > <event type="1" time="3:00"> > <event type="0" time="2:00"> > <event type="1" time="4:00"> > <event type="1" time="5:00"> > and i need sum of the minutes: number(substring-before(@time,':')) > only where @type=1. > > How it can be done? > The only way to sum over a computed value in pure XSLT 1.0 is to write a recursive named template. Alternatives if you're prepared to use extensions: (a) construct a result tree fragment holding the actual values you want to sum, and then use the sum() function on the nodes in this RTF (this will need the xx:node-set() extension (b) use an extension function such as saxon:sum(event/time, saxon:expression(substring-before(.,':')) Mike Kay XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








