Subject: RE: [xsl] A more concise way to handle empty numeric elements From: "Michael Kay" <mike@xxxxxxxxxxxx> Date: Thu, 7 Jun 2007 14:29:21 +0100 |
> 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/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] A more concise way to han, Andrew Welch | Thread | Re: [xsl] A more concise way to han, Andrew Welch |
RE: [xsl] Dynamically setting names, Michael Kay | Date | Re: [xsl] A more concise way to han, Andrew Welch |
Month |