SunQuest
           XML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreXML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old July 30th, 2003, 04:14 PM
ranjankumar17 ranjankumar17 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 57 ranjankumar17 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
XSL If Condition

Hi,

I have two different XML files which I need to process using the same XSL file.

One of the XML files has the <EMAILID> tag and the other XML file has the <S_SMTP_ADR> tag.

Each file can only have one of these tags.

What I need to do is populate a variable with the value in these tags if they are present.

My code below gives a syntax error:

<xsl:if test="$AppUserID.length > 0">
<xsl:value-of select="$AppUserID"/>
</xsl:if>

<xsl:if test="$RegUserID.length > 0">
<xsl:value-of select="$RegUserID"/>
</xsl:if>

Can anybody guide me here please.

Thanks,
__________________
Ranjan Kumar

Reply With Quote
  #2  
Old August 2nd, 2003, 10:04 PM
chinnman chinnman is offline
Fries w/ That?
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2002
Location: Kansas
Posts: 8 chinnman User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Instead of the if try the choose:

<xsl:choose>
<xsl:when test="$AppUserID.length > 0">
<xsl:value-of select="$AppUserID"/>
</xsl:when>
<xsl:when test="$RegUserID.length > 0">
<xsl:value-of select="$RegUserID"/>
</xsl:when>
<xsltherwise>
<xsl:text>It was not the first two!</text>
</xsltherwise>
</choose>

In this examp the otherwise is optional, but wanted to show it just it case it could come in handy. If something needs to be set if the other two fail then use the otherwise.

Hope this helps!
TCM!!

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > XSL If Condition


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway