I have the following XML file :
<?xml version="1.0"?>
<Table69>
</Table69>
And want to read the body of element "Table69", I have used the following XSL file :
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml"/>
<xsl:template match="/">
<xsl:variable name="table" >
<xsl:choose>
<xsl:when test="normalize-space(.) != ''" >
<xsl:value-of select="." />
</xsl:when>
<xsl:otherwise>
<Exception>
field was missing
</Exception>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<Table id="69">
<xsl:value-of select="$table" />
</Table>
</xsl:template>
</xsl:stylesheet>
The problem is : When the xml file contains value under Table69 tage, this value is beging printed successfully, but; when this tag doesn't contains a value, the xsl vairalbe "table" should contain the following :
<Exception>
field was missing
</Exception>
but, it doesn't include tage, here's a sample result of transforming :
<?xml version="1.0"?>
<Table id="69">
field was missing <!-- where's the Exception tag surrounding the text field was missing ??? -->
</Table>