XPATH - Select all child nodes with a specific attribute

前端 未结 2 682
星月不相逢
星月不相逢 2021-01-13 03:36

What would be the xpath query to find all child nodes with a specific attribute value, but starting from a node with a specific attribute value?

This is kind of rela

2条回答
  •  遥遥无期
    2021-01-13 04:29

    $xpath->query("//*[@rdf:about='http://rdfs.org/sioc/ns#']/following-sibling::*/@rdf:about");

    With your sample script, outputs URLs starting/ending with:

    http://rdfs.org/sioc/ns#Community
    http://rdfs.org/sioc/ns#Container
    ...
    http://rdfs.org/sioc/ns#reference
    http://rdfs.org/sioc/ns#subject

提交回复
热议问题