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 March 21st, 2013, 06:03 PM
Authorized User
 
Join Date: Apr 2010
Posts: 61
Thanks: 12
Thanked 0 Times in 0 Posts
Default Code Works One Way but Not Another When Testing For Values

Hello.

I have the following XML data.
Code:
        <DETAIL>
            <DETAILLINE>
                <SEQUENCE>000001</SEQUENCE>
                <RCDATA>
                    <RCDATALINE>
                        <RC>BR</RC>
                        <RCOVERRIDE>Y</RCOVERRIDE>
                    </RCDATALINE>
                    <RCDATALINE>
                        <RC>38</RC>
                        <RCOVERRIDE>N</RCOVERRIDE>
                    </RCDATALINE>
                </RCDATA>
            </DETAILLINE>
            <DETAILLINE>
                <SEQUENCE>000002</SEQUENCE>
                <RCDATA>
                    <RCDATALINE>
                        <RC>WU</RC>
                        <RCOVERRIDE>Y</RCOVERRIDE>
                    </RCDATALINE>
                    <RCDATALINE>
                        <RC>40</RC>
                        <RCOVERRIDE>N</RCOVERRIDE>
                    </RCDATALINE>
                </RCDATA>
            </DETAILLINE>
        </DETAIL>
I have this code that works correctly when checking for a <RC> not = 40.
Code:
/doc/EOB/DETAIL/DETAILLINE/RCDATA/RCDATALINE[RC!='40'][RC!=''][RCOVERRIDE!='Y']
However, when I want to test for a <RC> = 'WU' or 'WX', nothing is returned.
Code:
/doc/EOB/DETAIL/DETAILLINE/RCDATA/RCDATALINE[RC='WU'][RC='WX'][RCOVERRIDE!='Y']
I can create two separate tests but think there has to be a better way than this clumsy solution.

Thanks,
Rita
 
Old March 22nd, 2013, 05:16 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

It's perfectly possible for an RC value to be not equal to '' and not equal to '40' at the same time, but it's quite hard to be equal to 'WU' and equal to 'WX' at the same time.
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
 
Old March 22nd, 2013, 12:55 PM
Authorized User
 
Join Date: Apr 2010
Posts: 61
Thanks: 12
Thanked 0 Times in 0 Posts
Default

Yes, thank you, I see that now.
I was thinking that sentence equated to testing for RC = 'WU' OR 'WX'.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Source code which really works bill x. BOOK: Professional PHP Design Patterns 0 February 4th, 2013 11:10 PM
Code that works !! for chapter 3 dawsonje44 BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 0 March 2nd, 2007 04:33 PM
Testing for NULL Values in a Combo Box Aaron Edwards Access 2 September 28th, 2005 09:37 AM
code works in IE but not netscape Toka1 Javascript How-To 2 November 27th, 2003 05:35 AM





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