You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xindice-users@xml.apache.org by Matthew Van Horn <ho...@accesstech.com> on 2002/10/23 06:07:39 UTC

getting an attribute value back

I am having a problem retrieving attribute values from a document in a 
collection. i though I knew XPath pretty well, but maybe I am screwing 
up somehow...

The structure of my doc is:
<root>
	<parent>
		<child name="foo">
			<baz>AAA </baz>
			< baz>BBB </baz>
			< baz>CCC </baz>
		</child>
		<child name="foo">
			< baz>DDD </baz>
			< baz>EEE </baz>
			< baz>FFF </baz>
		</child>
	</parent>
	...
	<some_other_data/>
</root>

These queries work:
//root/child
//root[//child[@name='foo']]/some_other_data
//root[//child[@name='foo']/baz[text()='AAA']]/some_other_data

(the first one returns the child node with the attributes intact, so I 
know they are there)

These queries return nothing:
//root/parent/child/@name
//root//child/@name
//root//child/@*
//@*
//root/child[@name='foo']/@name

I am desperate to figure this out, thanks for any help!
Matt Van Horn