Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old January 31st, 2018, 07:47 PM
Authorized User
Points: 298, Level: 5
Points: 298, Level: 5 Points: 298, Level: 5 Points: 298, Level: 5
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Apr 2010
Posts: 57
Thanks: 11
Thanked 0 Times in 0 Posts
Default What Am I Missing!

Hello,

Using the code below I get the results I'm expecting.
Code:
<xsl:variable name="varDenialCRC">
  <xsl:choose>
    <xsl:when test="../../CRCDATA/CRCDATALINE[CRCFUNCTION='900' and CRCOVERRIDE!='']">
	Y
    </xsl:when>
    <xsl:otherwise>
	N
    </xsl:otherwise>
  </xsl:choose>
</xsl:variable>
<xsl:if test="RC[.!=''] and RCOVERRIDE[.!='Y']">
  <xsl:value-of select="$varDenialCRC"/>
  <xsl:value-of select="RC"/>
</xsl:if>
Line 1 prints: Y 01
Line 2 prints: Y 01
Line 3 prints: N 01

However, when I include a test using varDenialCRC I get nothing printing out!
Code:
<xsl:variable name="varDenialCRC">
  <xsl:choose>
    <xsl:when test="../../CRCDATA/CRCDATALINE[CRCFUNCTION='900' and CRCOVERRIDE!='']">
	Y
    </xsl:when>
    <xsl:otherwise>
	N
    </xsl:otherwise>
  </xsl:choose>
</xsl:variable>
<xsl:if test="RC[.!=''] and RCOVERRIDE[.!='Y'] and $varDenialCRC='N'">
  <xsl:value-of select="$varDenialCRC"/>
  <xsl:value-of select="RC"/>
</xsl:if>
I'm expecting the following:
Line 1 prints:
Line 2 prints:
Line 3 prints: N 01

but the following is the result:
Line 1 prints:
Line 2 prints:
Line 3 prints:

I cant see what the issue is!
Any help is greatly appreciated.

Thanks,
Rita
Reply With Quote
  #2 (permalink)  
Old January 31st, 2018, 08:10 PM
mhkay's Avatar
Wrox Author
Points: 18,298, Level: 58
Points: 18,298, Level: 58 Points: 18,298, Level: 58 Points: 18,298, Level: 58
Activity: 50%
Activity: 50% Activity: 50% Activity: 50%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,936
Thanks: 0
Thanked 284 Times in 279 Posts
Default

There's lots of whitespace before and after the "N", which makes the variable not equal to the simple string "N".
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
Reply With Quote
The Following User Says Thank You to mhkay For This Useful Post:
ritagr (January 31st, 2018)
  #3 (permalink)  
Old January 31st, 2018, 08:18 PM
Authorized User
Points: 298, Level: 5
Points: 298, Level: 5 Points: 298, Level: 5 Points: 298, Level: 5
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Apr 2010
Posts: 57
Thanks: 11
Thanked 0 Times in 0 Posts
Default What Am I Missing

I changed my code to
Code:
<xsl:variable name="varDenialCRC">
  <xsl:choose>
    <xsl:when test="../../CRCDATA/CRCDATALINE[CRCFUNCTION='900' and CRCOVERRIDE!='']">Y</xsl:when>
    <xsl:otherwise>N</xsl:otherwise>
  </xsl:choose>
</xsl:variable>
Once again, thank you so much for your help!
Reply With Quote
Reply


Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Italic missing RockBal XSLT 1 December 14th, 2010 12:18 PM
Must be missing something cycokris BOOK: Professional XMPP Programming with JavaScript and jQuery 2 December 5th, 2010 07:57 PM
Is there some ':, missing ??? saban SQL Server ASP 1 May 28th, 2007 07:32 AM
What is missing? grstad SQL Language 11 March 6th, 2006 01:53 AM
what am i missing? m002864 Crystal Reports 0 July 6th, 2004 08:24 AM



All times are GMT -4. The time now is 11:12 AM.


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.