• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Tim Cooke
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
  • Piet Souris
Bartenders:
  • Stephan van Hulst

help with ....

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"/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?
 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As mentioned above you will get a list of sku elements with unique (string)value.
 
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
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic