xml - fix xslt bug for validation -


i need validate value of invoice element in xslt: missing element = default 1 (working)...blank = default 1(working)...but 2 or numbers in string not working because keeps return 1.

<xsl:template match="transaction" >   <transaction invoice="{invoice}">     <xsl:attribute name="invoice">       <xsl:choose>         <xsl:when test="@invoice , (@invoice!='') , (@invoice!='0')">         <xsl:value-of select="@invoice"/></xsl:when>         <xsl:otherwise>1</xsl:otherwise>       </xsl:choose>      </xsl:attribute> </xsl:template> 

hope you. appreciate lot.

thanks

in when condition use , instead of and (seems lowercase good)

start simple condition , add 1 @ time see 1 bad:

<xsl:when test="@invoice"> 

then

<xsl:when test="@invoice , (@invoice!='')"> 

then

<xsl:when test="@invoice , (@invoice!='') , (@invoice!=0)"> 

althoug have wrote

<xsl:when test="@invoice , (@invoice &gt; 0)"> 

Comments