Hi: I am learning xPath and have difficulty in understand the explaination of "/descentant::sku[not(.=preceding::sku)]". The explaination in the book is: "Identifies the descendant sku elements with string-values that do not equal those of one of the preceding sku elements. This expression only identifies the first sku with the same value are excluded from the result node-set." From my understanding, "." in the predicates refers to current node. But the explaination seems refer "." as the descendant sku element. What should "." refer to? Why This expression only identifies the firstsku with the same value are excluded from the result node-set. Your help is highly appreciated. Thanks, Nancy
"/descentant::sku[not(.=preceding::sku)]". I believe "/descentant::sku" will return back a node-set of sku, the conditiion [not(.=preceding::sku)] will be applied to each node in the set, then "." means each sku node being tested. Any comments?
You are right niachen. This is how it goes. Remember the CONTEXT funda. when you say /descendant::sku, the context gets changed to the element sku. Now the predicate part. This sku (.) should not be equal to the previous (Note preceding:: means previous sibling) sku element.
Karthik Jayaraman.<br />IBM Certified Developer - XML and Related Technologies.<br />Sun Certified Developer for java WebServices.<br />Sun Certified Java Programmer.
As mentioned above you will get a list of sku elements with unique (string)value.
Karthik Jayaraman.<br />IBM Certified Developer - XML and Related Technologies.<br />Sun Certified Developer for java WebServices.<br />Sun Certified Java Programmer.
Where all the women are strong, all the men are good looking and all the tiny ads are above average:
Gift giving made easy with the permaculture playing cards