XPath Practice
- How would you isolate the ID number of this encoded text (VAA4025-109-1-a16)?
- How many lists are in the article text?
- How would you isolate the copyright statement (Copyright 2013 Trustees of Indiana University)?
- //publicationStmt/availability/p[contains(., "Copyright")]
- What are two different ways to isolate the publisher and pubPlace elements together (Indiana University Libraries Bloomington, IN)?
- /TEI.2/teiHeader/fileDesc/publicationStmt/*[position()<3]
- /TEI.2/teiHeader/fileDesc/publicationStmt/publisher|//publicationStmt/pubPlace
- How many paragraphs are in the text of this article?
- What different states are mentioned in the text?
- Indiana, Ohio, South Carolina, Kentucky, Arkansas, North Carolina
- /TEI.2/text//region[@type="state"]
- How many distinct cities are mentioned in the text? Hint: use distinct-values()
- 25
- count(/TEI.2/text/distinct-values(//settlement[@type="city"]))
- How many times does “Evansville” appear in this article? Hint: use ctrl+F to check your work
- 2
- count(/TEI.2/text//p[contains(., "Evansville")])
- What’s your best guess for how to figure out how many book reviews there are in this article using XPath alone?
- count(/TEI.2/text/body/div/p/hi[@rend="i"])