Subject: RE: [xsl] Understanding Identity Transformations From: "Michael Kay" <mike@xxxxxxxxxxxx> Date: Sat, 12 Feb 2005 22:00:49 -0000 |
> > Wow.. that is easy except that I do not understand your notice > > explanation... the difference between your not( ... ) and your !=. > > "@cat != 'BLUE'": will be true if the context node has a > 'cat' attribute > *and* if it has a 'cat' attribute not equal to 'BLUE'. So > it's the same as > "boolean(@cat) and not(@cat='BLUE')" > > "not(@cat='BLUE')": will be true if the context node has no 'cat' > attribute *or* if it has a 'cat' attribute not equal to > 'BLUE'. So it's > equal to "not(@cat) or not(@cat='BLUE')" Let's try to phrase it a different way. An expression such as X=Y in XPath is shorthand for some $x in X, $y in Y satisfies $x=$y in other words, it's true if there's some pair of values from the two sets that are equal. Similarly, X!=Y is short for some $x in X, $y in Y satisfies $x!=$y which is true if there's some pair that are not equal. This means that if X is an empty set, then X=3 and X!=3 must both be false. If you're testing an attribute, @A=3, then @A is a set that's either empty or contains one node. If there's no A attribute, then @A!=3 is false (because there's no A that's not equal to 3), but not(@A=3) is true (because it's not true that there's an A that's equal to 3). Michael Kay http://www.saxonica.com/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Understanding Identity Tr, Karl Stubsjoen | Thread | Re: [xsl] Understanding Identity Tr, Karl Stubsjoen |
Re: [xsl] Understanding Identity Tr, Karl Stubsjoen | Date | Re: [xsl] Understanding Identity Tr, Karl Stubsjoen |
Month |