[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: A more concise way to handle empty numeric element
> hmmm it's a bit hacky but you can do: > > <xsl:variable name="zero">0</xsl:variable> > > <xsl:value-of select="(cost1/text()|$zero)[1] + > (cost2/text()|$zero)[1] + (cost3/text()|$zero)[1]"/> Unfortunately you can't predict which of (cost2/text()) and $zero will come first in document order. > > hopefully someone else will have a better idea... Yes, and I missed it: just sum over the non-empty nodes! Michael Kay http://www.saxonica.com/
|
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
|