I’m creating a Excel xml workbook via xslt. One of the date fields is often NULL and I need to not insert anything into the cell when this is the case. At the moment even though I’m not specifying anything the value -146087 is being entered into the cell. This is then displayed as hashes as the cell is date formatted.
What can I put between the
<xsl:otherwise></xsl:otherswise>
tags?
Here’s the xslt…
<Cell>
<Data ss:Type="DateTime">
<xsl:choose>
<xsl:when test="substring(EOI_StartDate, 0, 11)">
<xsl:value-of select="substring(EOI_StartDate, 0, 11)"/>
</xsl:when>
<xsl:otherwise>
</xsl:otherwise>
</xsl:choose>
</Data>
<NamedCell ss:Name="_FilterDatabase"/>
</Cell>
It seems from your question that you want to produce:
in the case when the condition is not fulfilled.
The simplest way to do this is not to use
<xsl:choose>but the simpler<xsl:if>:Or, in case you want to omit the
<Data>element completely if the condition is not satisfied, then:Finally, if the
<Data>element must stay there, but you don’t want it to be treated as date if the condition is not satisfied, do this: