<?xml-stylesheet href="teste.xsl" type="text/xsl" ?> <teste> <totais> <totpagto_p>12</totpagto_p> <totjpgto_p>52</totjpgto_p> </totais> <totais> <totpagto_p></totpagto_p> <totjpgto_p>12</totjpgto_p> </totais> </teste>* Documento de transformação definindo o padrão de formatação para NaN:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:decimal-format name="european" decimal-separator=',' grouping-separator='.' NaN='0,00'/> <xsl:template match="/"> <xsl:apply-templates select="/teste/totais" /> </xsl:template> <xsl:template match="totais"> <xsl:value-of select="format-number(totpagto_p + totjpgto_p, '###.###.###.##0,00', 'european')" /> <br/> </xsl:template> </xsl:stylesheet>Outra alternativa mais flexível, é testar o valor dos elementos e tomar a decisão mais apropriada através de constuções condicionais:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:decimal-format name="european" decimal-separator=',' grouping-separator='.'/> <xsl:template match="/"> <xsl:apply-templates select="/teste/totais" /> </xsl:template> <xsl:template match="totais"> <xsl:choose> <xsl:when test="totpagto_p + totjpgto_p"> <xsl:value-of select="format-number(totpagto_p + totjpgto_p, '###.###.###.##0,00', 'european')" /> </xsl:when> <xsl:otherwise> Valor resultante não é um número </xsl:otherwise> </xsl:choose> <br/> </xsl:template> </xsl:stylesheet>Espero que te ajude!