0

Basically, I've got an XML like this :

<com:myObject xmlns="myNamespaceUrl" xmlns:ref="myUrl/reference" xmlns:type="myUrl/type" xmlns:com="myUrl/common">
   <com:myNode help="12" ref:label="myLabel" type:cen="true">text</com:myNode
</com:myObjet>

When I try to get value for the node:

"com:myObject/@help"

I've got "12".

But my problem is when I try to get value for nodes:

"com:myObjet/@ref:label" or "com:myObject/@type:cen"

I've got no result. So I believe it comes from the namespace, but I'm not sure. I've declared the namespaces in my XSL file also.

I use the jaxp-api.1.4.2 plugin.

0

1 Answer 1

1
com:myObjet/@ref:label

and

com:myObject/@type:cen

return nothing because myObject does not have those attributes. They belong to myNode.

//com:myNode/@ref:label

returns the expected value. Note that xpaths are evaluated in context, so depending on where you execute the xpath from you may need to include the leading //.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.