# XPath query to select parent based on its descendent nodeType

**URL:** <https://community.bloomreach.com/t/xpath-query-to-select-parent-based-on-its-descendent-nodetype/1607>\
**Category:** Experience Manager (PaaS/OnPrem)\
**Created:** [November 29, 2019, 3:06pm UTC](https://community.bloomreach.com/t/xpath-query-to-select-parent-based-on-its-descendent-nodetype/1607 "2019-11-29T15:06:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kiki](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.bloomreach.com/kiki/32/529_2.png) [@kiki](https://community.bloomreach.com/u/kiki)\
**Post date:** [November 29, 2019, 3:06pm UTC](https://community.bloomreach.com/t/xpath-query-to-select-parent-based-on-its-descendent-nodetype/1607/1 "2019-11-29T15:06:35Z")

</div>

Hello ,

I have a content databse with several document types in them. Through an XPath query I want to select hippo:handle whose children are of a specific document type.  
I did something like this and it doesnt seem to filter out the other docTypes inside my hippo:handle file.  
/element(\*, hippo:handle)[descendant::db:docType]

Would anyone have better suggestions ?

Thanks  
Kiki

---

<div class="post-metadata">

**Author:** ![jeroen.hoffman](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.bloomreach.com/jeroen.hoffman/32/43_2.png) [@jeroen.hoffman](https://community.bloomreach.com/u/jeroen.hoffman)\
**Post date:** [November 29, 2019, 3:26pm UTC](https://community.bloomreach.com/t/xpath-query-to-select-parent-based-on-its-descendent-nodetype/1607/2 "2019-11-29T15:26:29Z")

</div>

Hi,  
How about just `//element(*, yournamespace:yourdoctype)/..` ?  
Jeroen

---

<div class="post-metadata">

**Author:** ![jeroen.hoffman](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.bloomreach.com/jeroen.hoffman/32/43_2.png) [@jeroen.hoffman](https://community.bloomreach.com/u/jeroen.hoffman)\
**Post date:** [November 29, 2019, 3:34pm UTC](https://community.bloomreach.com/t/xpath-query-to-select-parent-based-on-its-descendent-nodetype/1607/3 "2019-11-29T15:34:08Z")

</div>

Alternatively, `//element(*, hippo:handle)[*/@jcr:primaryType='yournamespace:yourdoctype']`
