[thelist] XML problem

David.Cantrell at Gunter.AF.mil David.Cantrell at Gunter.AF.mil
Wed Oct 30 15:29:01 CST 2002


Anybody know why I'm getting both of the below "stylesheet" nodes using this
XPath?

	XPath:  /layout/stylesheet

Doc snippet:

<layout>
	<stylesheet src="ROOT"/>
	<action>
		<stylesheet src="LOCAL"/>
	</action>
</layout>


I have the DOM parse the document and first extract the <stylesheet> nodes
at the root, if any. Then I have it look up the appropriate <action> nodes
and extract the specified <action> element's <stylesheet> element, if any.

I have two separate XPath statements for that:

	Root XPath:  /layout/stylesheet

	Action XPath:  /layout/action[@value="specified_action"]

However, when I print debug statements to the screen, it shows the root
XPath picking up BOTH stylesheet nodes. The root XPath should only pick up
the FIRST <stylesheet> node, not the second.

Any ideas?

TIA,
-dave



More information about the thelist mailing list