[xquery-talk] querying attribute?

Thomas R. Jones thomas.jones at maitreyasecurity.com
Wed Mar 18 13:06:10 PST 2009

Hello all, I have the following code:

<tests xmlns="http://oval.mitre.org/XMLSchema/oval-definitions-5">
check="all" comment="apache2 is installed"
id="oval:com.maitreyasecurity:tst:674" version="1">
  <object object_ref="oval:com.maitreyasecurity:obj:674"/>
  <state state_ref="oval:com.maitreyasecurity:ste:500"/>

I am trying everything i can think of to return the attribute value but
am hanging up on the namespace(i think). I believe because the attribute
is not prefixed that it is located within a NULL namespace and not the
element default namespace declared----correct? 

Here is my xquery:

declare default element namespace
"http://oval.mitre.org/XMLSchema/oval-definitions-5#linux"; for $attr in
document("apache2.package.novell.maitreyasecurity.en_US.xml","inventory.a")/tests/rpminfo_test/@id return string($attr)

Ideas? Thank you for your time.
Thomas Jones

More information about the talk mailing list