xsl:choose / xpath boolean
HejJeg har nogle problemer med at få min choose sætning til at virke
når jeg tester på henholdvis 0 og 1 i approved i mit XML dokument, så viser den ikke noget output
den interessante del af koden er her. hele koden er i bunden
<xsl:for-each select="ROWSET/ROW">
<xsl:chose>
<xsl:when test="number /page/appointments/ROWSET/ROW/accept='0'">
<xsl:apply-templates select="/page/appointments/ROWSET/ROW"
mode="unapproved"/>
</xsl:when>
<xsl:when test="number /page/appointments/ROWSET/ROW/accept='1'">
xsl:apply-templates select="page/appointments/ROWSET/ROW" mode="approved"/> </xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="noappoint"/>
</xsl:otherwise>
</xsl:chose>
</xsl:for-each>
<td>Table Finished </td></table>
</body>
</html>
</xsl:template>
Takker og med venlige hilsner
Thomas
Her kommer hele koden
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="page">
<html>
<head>
<title>View Appointments</title>
</head>
<body>
<h1>You have the following appointments</h1>
<table border="0" cellpadding="10">
<th>Start</th><th>Finish</th><th>Subject</th>
<xsl:for-each select="ROWSET/ROW">
<xsl:chose>
<xsl:when test="number /page/appointments/ROWSET/ROW/accept='0'">
<xsl:apply-templates select="/page/appointments/ROWSET/ROW" mode="unapproved"/>
</xsl:when>
<xsl:when test="number /page/appointments/ROWSET/ROW/accept ='1'">
<xsl:apply-templates select="page/appointments/ROWSET/ROW" mode="approved"/> </xsl:when>
<xsl:when test="number /page/appointments/ROWSET/ROW/accept ='2'">
<xsl:apply-templates select="page/appointments/ROWSET/ROW" mode="declined"/>
</xsl:when>
<xsl:when test="number /page/appointments/ROWSET/ROW/accept ='3'">
<xsl:apply-templates select="page/appointments/ROWSET/ROW" mode="deleted"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="noappoint"/>
</xsl:otherwise>
</xsl:chose>
</xsl:for-each>
<td>Table Finished </td></table>
</body>
</html>
</xsl:template>
<xsl:template match="accepted">
<xsl:value-of select="/page/appointments/ROWSET/ROW/accept"/>
</xsl:template>
<xsl:template match="noappoint">
<tr bgcolor="yellow">
<td>You currently have no appointments</td>
</tr>
</xsl:template>
<xsl:template match="/page/appointments/ROWSET/ROW" mode="unapproved">
<tr bgcolor="yellow">
<td><xsl:apply-templates select="datetimestart"/></td>
<td><xsl:apply-templates select="datetimefinish"/></td>
<td><xsl:apply-templates select="subject"/></td>
</tr>
</xsl:template>
<xsl:template match="/page/appointments/ROWSET/ROW" mode="approved">
<tr bgcolor="blue">
<td><xsl:apply-templates select="datetimestart"/></td>
<td><xsl:apply-templates select="datetimefinish"/></td>
<td><xsl:apply-templates select="subject"/></td>
</tr>
</xsl:template>
<xsl:template match="/page/appointments/ROWSET/ROW" mode="declined">
<tr bgcolor="red">
<td><xsl:apply-templates select="datetimestart"/></td>
<td><xsl:apply-templates select="datetimefinish"/></td>
<td><xsl:apply-templates select="subject"/></td>
</tr>
</xsl:template>
<xsl:template match="/page/appointments/ROWSET/ROW" mode="deleted">
<tr bgcolor="grey">
<td><xsl:apply-templates select="datetimestart"/></td>
<td><xsl:apply-templates select="datetimefinish"/></td>
<td><xsl:apply-templates select="subject"/></td>
</tr>
</xsl:template>
</xsl:stylesheet>