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 January 31st, 2018, 07:47 PM
Authorized User
 
Join Date: Apr 2010
Posts: 61
Thanks: 12
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
 
Old January 31st, 2018, 08:10 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 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
The Following User Says Thank You to mhkay For This Useful Post:
ritagr (January 31st, 2018)
 
Old January 31st, 2018, 08:18 PM
Authorized User
 
Join Date: Apr 2010
Posts: 61
Thanks: 12
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!





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 06: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 07:24 AM





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