Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Select first instance only with XPath

By: a guest on Feb 26th, 2012  |  syntax: None  |  size: 0.36 KB  |  views: 22  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <root>
  2.     <some_gunk/>
  3.     <dupe_node>
  4.         ...
  5.         stuff I want
  6.         ...
  7.     </dupe_node>
  8.     <bits_and_pieces/>
  9.     <other_gunk/>
  10.     <dupe_node>
  11.         ...
  12.         stuff I don't want
  13.         ...
  14.     </dupe_node>
  15.     <more_gunk/>
  16. </root>
  17.        
  18. /descendant::dupe_node[1]
  19.        
  20. <foo>
  21.     <bar/>
  22.     <foo>
  23.         <bar/>
  24.     </foo>
  25. </foo>
  26.        
  27. //dupe_node[1]