Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 28th, 2005, 08:01 AM
Registered User
 
Join Date: Oct 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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() &gt; $startingPhoto and position() &lt;=($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>







Similar Threads
Thread Thread Starter Forum Replies Last Post
Part Default Value Brendan Bartley Access 3 September 18th, 2008 11:41 AM
What web part have they used? sharepointbaby BOOK: Beginning SharePoint 2007: Building Team Solutions with MOSS 2007 ISBN: 978-0-470-12449-9 0 May 30th, 2008 08:51 PM
Getting Part of a String needelp Access VBA 4 September 19th, 2006 06:22 AM
Web part soso_soso SharePoint Development 0 September 7th, 2006 07:37 AM
The difficult part k0023382 Access 1 October 8th, 2004 03:37 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.