I couldn't find an option in db:add to specificy an XPath. In my case, I need to extract only the elements under /gmd:MD_Metadata/gmd:identificationInfo/sdn:SDN_DataIdentification
We try to avoid XPath strings arguments whenever possible. Instead, simply use XQuery, which allows you to do all kinds of things.
Example 1 (add one document per element):
for $node at $pos in /gmd:MD_Metadata/..... return db:add('db', $pos || '.xml', $node)
Example 2 (add single document):
db:add('db', 'doc.xml', element xml { /gmd:MD_Metadata/..... })
Cheers, Christian