DFDL includes an expression language based on XPath.
Turns out that there are some "issues" with XPath 1.0 and XML namespaces.
If you have XML data that has a namespace, such as:
<data xmlns="urn:someNamespaceOrOther"><a>75</a></data>
Well, it turns out that there is no way to get this XPath to work:
/data/a
Apparently, there is no mechanism for associating an unqualified XPath path step, (such as 'data' or 'a' in the path) to be implicitly qualified by a namespace. This path can only work if the data has no namespace specified.
There are a few ways to deal with this problem.
If you have all non-qualfied elements with none of these xmlns="..." things around like this:
<data><a>75</a></data>
well, this works fine with the XPath /data/a.
You can qualify every element. This is in some sense the most robust approach. So if you write:
<tns:data xmlns:tns="urn:someNamespaceOrOther"><tns:a>75</tns:a></tns:data>
Then the path
/tns:data/tns:a
is meaningful and works.
If you really can't stand the tns prefix clutter in the data, then you can add a prefix along side the non-prefix namespace. This prefix is there for XPath:
<data xmlns="urn:someNamespaceOrOther" xmlns:tns="urn:someNamespaceOrOther"><a>75</a></data>
This tns prefix definition enables qualified XPath expressions to also work. Notice that the unqualified namespace and the tns namespace prefix are bound to the same namespace, so this path:
/tns:data/tns:a
also works in this case.