Part Solution...
I have produced this xsl thus far. All that remains is to construct the syntax for the url when test. I would like to know how to work out if there are any next or previous images left in the xml, to then display a link accordingly.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:param name="user_name">****</xsl:param>
<xsl:param name="faculty">ITS</xsl:param>
<xsl:param name="action_url">action not set</xsl:param>
<xsl:param name="photo_server">not found</xsl:param>
<xsl:param name="page_number">0</xsl:param>
<xsl:param name="group_name">Not been set yet...</xsl:param>
<xsl:param name="startingPhoto">10</xsl:param>
<xsl:param name="howMany">15</xsl:param>
<xsl:template match="/">
<head>
<link type="text/css" rel="stylesheet" href="css/myuwe.css"/>
</head>
<table width="640">
<tr>
<td colspan="2">
<h2>View Photos</h2>
</td>
</tr>
<tr>
<td width="420">Name: <xsl:value-of select="$user_name"/><br/>Your Faculty: <xsl:value-of
select="$faculty"/></td>
<td valign="top" align="right">
<xsl:apply-templates select="/PhotosData/groups"/>
</td>
</tr>
<tr>
<td colspan="2">
<xsl:apply-templates select="/PhotosData/photos"/>
</td>
</tr>
</table>
</xsl:template>
<xsl:template match="groups">
<form method="post" action="{$action_url}">
<select name="selected-group">
<xsl:apply-templates select="group"/>
</select>
<input type="submit" value="select group"/>
</form>
</xsl:template>
<xsl:template match="group">
<xsl:variable name="groupName">
<xsl:value-of select="."/>
</xsl:variable>
<option value="{$groupName}">
<xsl:value-of select="$groupName"/>
</option>
</xsl:template>
<xsl:template match="photos">
<xsl:variable name="previous" select="number($startingPhoto - $howMany)"/>
<xsl:variable name="next" select="number($startingPhoto + $howMany)"/>
<table cellpadding="5" border="4" width="640" align="left">
<tr>
<td>
<h3>Photos for <em>
<xsl:value-of select="$group_name"/>
</em></h3>
</td>
</tr>
<tr>
<td>
viewing page number <xsl:value-of select="$page_number"/>
</td>
</tr>
<tr>
<td>
<xsl:apply-templates select="record"/>
</td>
</tr>
<tr>
<td>
<xsl:choose>
<xsl:when test="">
<a href="{$action_url}?startingPhoto={$previous}">nex t <xsl:value-of
select="$howMany"/></a>
</xsl:when>
<xsl:otherwise> </xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test=" ">
<a href="{$action_url}?startingPhoto={$next}">last <xsl:value-of select="$howMany"
/></a>
</xsl:when>
<xsl:otherwise> </xsl:otherwise>
</xsl:choose>
</td>
</tr>
</table>
</xsl:template>
<xsl:template match="record">
<xsl:if test="position() > $startingPhoto and position() <=($startingPhoto +
$howMany)"> Name: <xsl:value-of select="name"/>
</xsl:if>
<!-- <xsl:variable name="photoId"><xsl:value-of select="./id"/></xsl:variable>
<xsl:variable name="name"><xsl:value-of select="./name"/></xsl:variable>
<img src="{$photo_server}/?studentId=$photoId"/><br/>
<xsl:value-of select="$name"/><br/> -->
</xsl:template>
</xsl:stylesheet>
|