XPath for WWP encoders

From Digital Scholarship Group
Jump to navigation Jump to search

XPath is incredibly useful for searching the textbase—the first thing you'll want to do is get set up with the working set you want (and you can find information on configuring working sets at this page. You can also find the searching strategies outlined here), particularly if you want to combine XPath with oXygen's "Find" options.

Resources


Recipes

Example-finders

Find me...

  • ... any element X that has an attribute named Y
    //X[@Y]
    //distinct[@type]
    ... any element X that does not have an attribute named Y
    //distinct[not(@type)]


  • ... any element X that has a child element W
    //orgName[placeName]
    //placeName/parent::orgName
    ... any element X that does not have a child element W
    //orgName[not(placeName)]


  • ... any element X where its attribute named Y has a value of Z
    //distinct[@type eq 'dialect']
    //distinct[@type='dialect']
    ... any element X where its attribute named Y does not have a value of Z
    //distinct[@type ne 'dialect']
    //distinct[not(@type='dialect')]

Exploratory queries

List...

  • ... all values used in attribute Y
    distinct-values(//sourceDesc//resp/@type)


  • ... the names of all elements which are parents of element X
    //imprimatur/parent::*/name()
    //*[imprimatur]/name()
    ... the unique names of all elements which are parents of element X
    distinct-values(//imprimatur/parent::*/name())
    distinct-values(//*[imprimatur]/name())