Examples of location paths using the unabbreviated syntax

Source: Internet
Author: User
  • Child: ParaSelectsParaElement children of the context node

  • Child ::*Selects all element Children Of The context node

  • Child: Text ()Selects all text node children of the context node

  • Child: node ()Selects all the children of the context node, whatever their Node Type

  • Attribute: NameSelectsNameAttribute of the context node

  • Attribute ::*Selects all the attributes of the context node

  • Descendant: ParaSelectsParaElement descendants of the context node

  • Ancestor: divSelects allDivAncestors of the context node

  • Ancestor-or-self: divSelectsDivAncestors of the context node and, if the context node isDivElement, the context node as well

  • Descendant-or-self: ParaSelectsParaElement descendants of the context node and, if the context node isParaElement, the context node as well

  • SELF: ParaSelects the context node if it isParaElement, and otherwise selects nothing

  • Child: Chapter/descendant: ParaSelectsParaElement descendants ofChapterElement children of the context node

  • Child: */child: ParaSelects allParaGrandchildren of the context node

  • /Selects the document root (which is always the parent of the document element)

  • /Descendant: ParaSelects allParaElements in the same document as the context node

  • /Descendant: olist/child: itemSelects allItemElements that haveOlistParent and that are in the same document as the context node

  • Child: para [position () = 1]Selects the firstParaChild of the context node

  • Child: para [position () = last ()]Selects the lastParaChild of the context node

  • Child: para [position () = last ()-1]Selects the last but oneParaChild of the context node

  • Child: para [position ()> 1]Selects allParaChildren of the context node other than the firstParaChild of the context node

  • Following-Sibling: chapter [position () = 1]Selects the nextChapterSibling of the context node

  • Preceding-Sibling: chapter [position () = 1]Selects the previousChapterSibling of the context node

  • /Descendant: Figure [position () = 42]Selects the forty-secondFigureElement in the document

  • /Child: DOC/child: chapter [position () = 5]/child: Section [position () = 2]Selects the secondSectionOf the thChapterOfDocDocument Element

  • Child: para [attribute: TYPE = "warning"]Selects allParaChildren of the context node that haveTypeAttribute with valueWarning

  • Child: para [attribute: TYPE = 'warning'] [position () = 5]Selects the thParaChild of the context node that hasTypeAttribute with valueWarning

  • Child: para [position () = 5] [attribute: TYPE = "warning"]Selects the thParaChild of the context node if that child hasTypeAttribute with valueWarning

  • Child: chapter [Child: Title = 'inserduction ']SelectsChapterChildren of the context node that have one or moreTitleChildren with string-value equalIntroduction

  • Child: chapter [Child: title]SelectsChapterChildren of the context node that have one or moreTitleChildren

  • Child: * [self: chapter or self: appendix]SelectsChapterAndAppendixChildren of the context node

  • Child: * [self: chapter or self: appendix] [position () = last ()]Selects the lastChapterOrAppendixChild of the context node

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.