XPath - zkrácená notace - Příklady

  • para vybere všechny dceřinné elementy kontextového uzlu jmenující se para

  • * selects all element children of the context node

  • text() selects all text node children of the context node

  • @name selects the name attribute of the context node

  • @* selects all the attributes of the context node

  • para[1] selects the first para child of the context node

  • para[last()] selects the last para child of the context node

  • */para selects all para grandchildren of the context node

  • /doc/chapter[5]/section[2] selects the second section of the fifth chapter of the doc

  • chapter//para vybere všechny element para, jež jsou následníky chapter

  • //para vybere všechny elementy para z dokumentu

  • //olist/item vybere všechny elementy item, které mají za rodiče olist. vybere kontextový uzel

  • .//para vybere všechny elementy-potomky kontextového uzlu, které nesou značku para

  • .. vybere rodičovský uzel od kontextového

  • ../@lang vybere atribut lang rodičovského uzlu od kontextového