简体   繁体   中英

Xpath: How to select value of parent note in xpath if child exists

I try to build a html table with javascript out of a xml

Therefore I need the value of a parent element from a different ancestor called "name" with xpath, if a child with eg //host exists

I need only the channel name out of the xpath:

"/serverConfiguration/channels/channel/name"

where the child

"/serverConfiguration/channels/channel/sourceConnector/properties/listenerConnectorProperties/host"

exists

就XPath而言,似乎您只需要谓词/serverConfiguration/channels/channel[.//host]/name/serverConfiguration/channels/channel[sourceConnector/properties/listenerConnectorProperties/host]/name

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM