Hi , Is it possible to add a conditional statement to XML document ?
Thank in advance
Hi , Is it possible to add a conditional statement to XML document ?
Thank in advance
The question doesn't really make sense. An XML document is just a document. It may represent some sort of execution flow, but that's specific to the kind of XML document it is.
There's no "general" idea of a conditional bit of an XML document - and really no idea of a "statement" in XML either.
What are you really trying to do? What's the concrete problem you're trying to solve?
As Jon states, XML has no general idea of conditions. However, if you are referring to XSLT, a format based upon XML that is used for translation of one text format to another, then you are looking for the xsl:choose element.
You use it like this (from W3 Schools):
<xsl:choose>
<xsl:when test="price > 10">
<td bgcolor="#ff00ff">
<xsl:value-of select="artist"/></td>
</xsl:when>
<xsl:otherwise>
<td><xsl:value-of select="artist"/></td>
</xsl:otherwise>
</xsl:choose>