W
will
why doesnt this work? Im basically trying to get the value of the root
node attribute the 'Result' attr. Which can be one of 3 things. OK,
ERROR or INVALID, and then choosing between the 3 and outputting
different stuff. It always prints out "OtherwiseHasBeenSelected"
suggesting it doesnt test true on any of my choices :
xsl:
<?xml version='1.0' encoding='iso-8859-1'?>
<xsl:stylesheet version='1.0'
xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
<xslutput method='html' version='1.0' encoding='iso-8859-1'
indent='no'/>
<xsl:template match="/">
<html>
<head>
<title>
Car Park Availability Page
</title>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"
bgcolor="#FFFFFF">
<xsl:choose>
<xsl:when test="API_Reply[@Result]='OK'">
<center>
<xsl:apply-templates select="API_Reply/CarPark"/>
</center>
</xsl:when>
<xsl:when test="API_Reply[@Result]='ERROR' ">
An error has occured: <xsl:value-of
select="API_Reply/Error/ErrorMessage"/>
</xsl:when>
<xsltherwise>
<center>
OtherwiseHasBeenSelected <xsl:apply-templates
select="API_Reply/CarPark"/>
</center>
</xsltherwise>
</xsl:choose>
</body>
</html>
</xsl:template>
xml:
<API_Reply System="ABC" Version="1.0" Product="CarPark" Customer="A"
Session="000014653" RequestCode="1"
Result="ERROR"><Error><ErrorMessage>Not available try a hotel with
parking</ErrorMessage></Error></API_Reply>
node attribute the 'Result' attr. Which can be one of 3 things. OK,
ERROR or INVALID, and then choosing between the 3 and outputting
different stuff. It always prints out "OtherwiseHasBeenSelected"
suggesting it doesnt test true on any of my choices :
xsl:
<?xml version='1.0' encoding='iso-8859-1'?>
<xsl:stylesheet version='1.0'
xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
<xslutput method='html' version='1.0' encoding='iso-8859-1'
indent='no'/>
<xsl:template match="/">
<html>
<head>
<title>
Car Park Availability Page
</title>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"
bgcolor="#FFFFFF">
<xsl:choose>
<xsl:when test="API_Reply[@Result]='OK'">
<center>
<xsl:apply-templates select="API_Reply/CarPark"/>
</center>
</xsl:when>
<xsl:when test="API_Reply[@Result]='ERROR' ">
An error has occured: <xsl:value-of
select="API_Reply/Error/ErrorMessage"/>
</xsl:when>
<xsltherwise>
<center>
OtherwiseHasBeenSelected <xsl:apply-templates
select="API_Reply/CarPark"/>
</center>
</xsltherwise>
</xsl:choose>
</body>
</html>
</xsl:template>
xml:
<API_Reply System="ABC" Version="1.0" Product="CarPark" Customer="A"
Session="000014653" RequestCode="1"
Result="ERROR"><Error><ErrorMessage>Not available try a hotel with
parking</ErrorMessage></Error></API_Reply>