Hi Henry,
thank you for your reply. That was the missing link. Unfortunately this doesn't solve my problem. I think that there is no magic cheat to tell the parser to add the default namespaces for attributes, too. :-(
One solution would be to set the prefix for all attributes in the default namespace manually. However I think this is a bad solution. In general, should attributes have an namespace, or not ?
Or is there any other way to solve my problem? I defintely have to deal with documents that have the prefix set in the attributes, others *use* the default namespace.
Thanks,
Marcel
Henry Zongaro wrote:
Hi Marcel,
The default namespace in an XML file never applies to attributes. See Section 5.2 of the Namespaces in XML Recommendation [1] for more information.
I'm guessing that your input document looks something like the following. In this example, both the elements "BinaryCollaboration" and "Role" will be in the namespace identified by the URI http://example.org, but the attribute "name" will be in no namespace.
<BinaryCollaboration xmlns="http://example.org"> <Role name="friend"/> </BinaryCollaboration>
Exactly. Other documents look like that:
<tp:BinaryCollaboration xmlns:tp="http://example.org"> <tp:Role tp:name="friend"/> </tp:BinaryCollaboration>
How can I get the value "friend" with one xpath query in both documents?
I hope that helps.
Thanks,
Henry [1] http://www.w3.org/TR/REC-xml-names/#defaulting ------------------------------------------------------------------ Henry Zongaro Xalan development IBM SWS Toronto Lab T/L 969-6044; Phone +1 905 413-6044 mailto:[EMAIL PROTECTED]
