$ xmllint --xpath "/*[ name() = 'alto' ] /*[ name() = 'Description' ] /*[ name() = 'MeasurementUnit' ]" alto.xml inch1200 #### /* # posy /alto[1] # star /*[ name() = "alto" and position() = 1 and @xsi:schemaLocation = "http://www.loc.gov/standards/alto alto-v2.0.xsd" and @xmlns = "http://www.loc.gov/standards/alto/ns-v2#" and @xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" ] # rats /*[ name() = "alto" and position() = 1 and @xsi:schemaLocation = "http://www.loc.gov/standards/alto alto-v2.0.xsd" and @xmlns = "http://www.loc.gov/standards/alto/ns-v2#" and @xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" ] # "content" inch1200 ------ /*/* # posy /alto[1]/Description[1] # star /*[ name() = "alto" and position() = 1 and @xsi:schemaLocation = "http://www.loc.gov/standards/alto alto-v2.0.xsd" and @xmlns = "http://www.loc.gov/standards/alto/ns-v2#" and @xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" ] /*[ name() = "Description" and position() = 1 ] # rats /*[ name() = "alto" and position() = 1 and @xsi:schemaLocation = "http://www.loc.gov/standards/alto alto-v2.0.xsd" and @xmlns = "http://www.loc.gov/standards/alto/ns-v2#" and @xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" ] /Description[1] # "content" inch1200 ------ /*/*/* # posy /alto[1]/Description[1]/MeasurementUnit[1] # star /*[ name() = "alto" and position() = 1 and @xsi:schemaLocation = "http://www.loc.gov/standards/alto alto-v2.0.xsd" and @xmlns = "http://www.loc.gov/standards/alto/ns-v2#" and @xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" ] /*[ name() = "Description" and position() = 1 ] /*[ name() = "MeasurementUnit" and position() = 1 ] # rats /*[ name() = "alto" and position() = 1 and @xsi:schemaLocation = "http://www.loc.gov/standards/alto alto-v2.0.xsd" and @xmlns = "http://www.loc.gov/standards/alto/ns-v2#" and @xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" ] /Description[1] /MeasurementUnit[1] # "content" inch1200 ------