• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Testing against a node-set

 
Tong Chen
Ranch Hand
Posts: 1011
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Regarding the XPath Expression,
If the test value is tested for equality against a node-set, the result is true if the node-set contains any node with a value that matches the test value.
If the test value is tested for not equal against a node-set, the result is true if the node-set contains any node with a value that different from the test value.
The result is that the node-set can be equal and not equal at the same time!!!
My question is: what's the purpose for testing against a node-set? can anyone give me an example/scenario?
Thanks,
 
Roseanne Zhang
Ranch Hand
Posts: 1953
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You post this in a wrong place
Ask w3c members, not JavaRanch members for this one. Even some smart JavaRanch members might give you an explanation, my advice is to ignore it. I'm serious, who knows what is in their mind.
The best thing I can offer you is here: Q. Why Java does this? Why Java does that? The original QA is for Java, but the concepts apply to XML, etc. too
[ November 15, 2002: Message edited by: Roseanne Zhang ]
 
Ron Newman
Ranch Hand
Posts: 1056
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is the single most confusing thing I had to learn about XPath and XSLT:
a != b
does not mean the same thing as
not (a=b)
 
Jayadev Pulaparty
Ranch Hand
Posts: 662
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tong,
What do you mean by -
The result is that the node-set can be equal and not equal at the same time!!!

What are you exactly looking for here?? Where did you pick up these statements from?
Roseanne, i'm taking the liberty of a guess here?
Are you looking forward to a scenario wherein you filter a set-of-nodes based on some predicate like the one shown here -
<xsl:apply-templates select="//someNode[@someAttr = 'someValue']"/>
Please donot ignore my post
Have a great weekend guys.
 
Jayadev Pulaparty
Ranch Hand
Posts: 662
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ron,
Please look at tip.25 in the following link for the a != b and not(a=b) stuff -
http://www.perfectxml.com/TipsXSLT.asp
Things are very well explained with an example.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic