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 February 17th, 2016, 06:47 PM
Registered User
 
Join Date: Dec 2015
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Single error message in loop

I want single error message to be displayed after loop is done,
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- Edited by XMLSpy® -->
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- Edited by XMLSpy® -->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="lname" select="null"/>
<xsl:param name="fname" select="null"/>

<xsl:template match="/">
<table class="stripeMe" width="700" cellpadding="5" cellspacing="1">
<thead>
<tr>
<td>Employee Name</td>
<td>Position</td>
<td>CALL US Extension</td>
<td>Direct Line</td>
</tr>

</thead>

<xsl:for-each select="Users/User_Detail">
<xsl:sort select="title" order="ascending" />
<xsl:sort select="last_name" order="ascending" />
<xsl:variable name="firstname" select="first_name" />
<xsl:variable name="lastname" select="last_name" />
<xsl:choose>
<xsl:when test="$lname!='' and $fname !=''">
<xsl:if test="contains($firstname,$fname)">
<xsl:if test="contains($lastname,$lname)">
<tr>

<td>
<strong>
<xsl:value-of select="first_name"/> <xsl:value-of select="last_name"/>
</strong>
</td>
<td>
<xsl:value-of select="title"/>
</td>
<td>
<xsl:value-of select="new_extension"/>
</td>
<td>
<xsl:value-of select="current_phone_number"/>
</td>
</tr>
</xsl:if>
</xsl:if>
<xsl:if test="$firstname!=$fname and $lastname!=$lname">
Record Not Found
</xsl:if>
</xsl:when>
<xsl:otherwise>
<xsl:if test="$fname!='' and $lname=''">
<xsl:if test="(contains($firstname,$fname))">
<tr>
<td>
<strong>
<xsl:value-of select="first_name"/> <xsl:value-of select="last_name"/>
</strong>
</td>
<td>
<xsl:value-of select="title"/>
</td>
<!--<td>
<xsl:value-of select="key('office-lookup', office_id)/Physical_Office_Name"/>
</td>-->
<td>
<xsl:value-of select="new_extension"/>
</td>
<td>
<xsl:value-of select="current_phone_number"/>
</td>
</tr>
</xsl:if>
<xsl:if test="$firstname!=$fname">
Record Not Found
</xsl:if>
</xsl:if>

<xsl:if test="$lname!='' and $fname=''">
<xsl:if test="(contains($lastname,$lname))">
<tr>
<td>
<strong>
<xsl:value-of select="first_name"/> <xsl:value-of select="last_name"/>
</strong>
</td>
<td>
<xsl:value-of select="title"/>
</td>
<!--<td>
<xsl:value-of select="key('office-lookup', office_id)/Physical_Office_Name"/>
</td>-->
<td>
<xsl:value-of select="new_extension"/>
</td>
<td>
<xsl:value-of select="current_phone_number"/>
</td>
</tr>
</xsl:if>
<xsl:if test="$lastname!=$lname">
Record Not Found
</xsl:if>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>

</table>

</xsl:template>
</xsl:stylesheet>

Last edited by nishritha; February 18th, 2016 at 08:15 AM..
 
Old February 18th, 2016, 07:15 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

You haven't given us enough information to go on.
__________________
/- Sam Judson : Wrox Technical Editor -/

Think before you post: What have you tried?





Similar Threads
Thread Thread Starter Forum Replies Last Post
Loop through a single form control collection while uploading file mat41 Classic ASP Professional 3 January 17th, 2014 03:44 AM
Retrieving a single value from a single column in a single row? Ron Howerton LINQ 2 May 17th, 2011 08:46 AM
What is the error message for a 500 server error? chobo2 C# 2005 1 May 4th, 2008 03:11 AM
ASP.Net Single Single-on with Oracle Application S guhanath Oracle 0 October 6th, 2004 05:05 AM





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