[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: If/then/else confusion
At 2012-12-25 12:19 -0700, Mark Wilson wrote:
I am trying to modify a sort-select statement I worked out a very long time ago. In the original, I wanted not to sort by a <Prefix> if it were an 'A' and this code does just that: Those two expressions are not polar opposites because at least one of the operands is a node set. This is an important issue that I bring up in the classroom because of the confusion of dealing with node sets. The result of the comparison is initialized as false() and then the comparisons begin with members of the node set. If the node set is empty, there are no comparisons and so false() is returned. So, if you have an element Prefix, then "Prefix != 'A'" returns true() if, say, Prefix has the value 'B'. But, "Prefix != 'A'" returns false() if there are no Prefix elements. One might think that that expression returning false() would imply that there is a Prefix and it has the value 'A'. It doesn't in this example (though it would be true if, in fact, there were a Prefix and it has the value 'A'). This is not intuitive and you need to know about how comparisons work with node sets. The polar opposite of "Prefix = 'A'" is "not( Prefix = 'A')". I have no idea what is going on and would appreciate any help I can get. I hope this helps explain your situation. And a Merry Christmas to you and other readers who celebrate it! . . . . . . . . Ken
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|