[Home] [By Thread] [By Date] [Recent Entries]
Dmitri,
I think you are right in suspecting that this is over-engineered -- if that's what you're suspecting. <us:item xmlns:us="www.uss.com"> <us:value>4000</us:value> </us:item> Could more easily be <item whose="us"> <value>4000</value> </item> <item whose="them"> <value>1000</value> </item> etc. Then <xsl:value-of select="format-number(sum(//us:value) - sum(//them:value), '###,###,##0.00')" /> and <xsl:value-of select="format-number(sum(//*[local-name() = 'value']), '###,###,##0.00')" /> could be <xsl:value-of select="format-number(sum(//item[@whose='us']/value) - sum(//item[@whose='them']/value), $sum-format)" /> and <xsl:value-of select="format-number(sum(//value), $sum-format)" /> (declaring $sum-format as '###,###,##0.00') Without knowing more about it, I think the application of namespaces doesn't get you much here: it merely makes things messy and complicated. (I can't, however, say what impact this would have on performance, if any, without trying it.) Things could be simplified even further if you don't actually need those <item> element wrappers (label the values themselves with their "owners"). Cheers, Wendell
|

Cart



