- From: Sarah Wilkin <swilkin@apple.com>
- Date: Mon, 6 Oct 2003 13:56:22 -0700
- To: Michael Rys <mrys@microsoft.com>
- Cc: public-qt-comments@w3.org
> $alt/node() does not retrieve namespace nodes so count($alt/node()) > should still return 0. That is interesting. Could a note to this effect be added to the spec? Currently it says "node() matches any node" (3.2.1.2). As "namespace" is listed under "nodes" in the Data Model (http://www.w3.org/TR/xpath-datamodel/#NamespaceNode), I would expect it to be matched as a node. > Namespace nodes are problematic and we decided to have as little > support > for them as we can. Also, we feel that we should not provide support > for > queries such as "elements with a certain namespace prefix" since such > information should not be semantically relevant (the name of an element > is determined by the namespace uri/name and local name and not the > prefix). It's true that the prefix *shouldn't* be semantically relevant, but is seems a strange aspect to limit (especially when it's easy from the implementer's perspective). In general, I don't understand how a namespace can be important enough to have a constructor, but not important enough to have a kind test. Say I'm translating from one type of document to another and my new document already uses "foo" as a prefix. It seems reasonable to have: let $doc := doc("http://some.doc") (: <a xmlns:foo="http://baz.com"/> etc :) let $transElems := for $elem in $doc//element() return element a { namespace bar { $elem/namespace()/string() }, $elem/text() } --Sarah >> -----Original Message----- >> From: public-qt-comments-request@w3.org [mailto:public-qt-comments- >> request@w3.org] On Behalf Of Sarah Wilkin >> Sent: Monday, October 06, 2003 12:13 PM >> To: public-qt-comments@w3.org >> Subject: KindTest for namespaces >> >> >> A clarification: >> A namespace may be generated either inline >> let $alt := <altitude xmlns:metric="http://example.org/metric-system/> >> or with a constructor >> let $alt := element altitude { namespace metric { >> "http://example.org/metric-system" } } >> but not with an attribute named or prefixed with "xmlns". >> >> However, writing it inline gives the impression that it could be >> matched as an attribute, such as $alt/@xmlns:metric. From what I >> understand, this is not the case. So count($alt/attribute()) would >> return 0, but count($alt/node()) would return 1. If this is the case, >> then it seems to be an omission not to have a namespace kind test >> (especially when there is one for every other kind of node). >> >> KindTests namespace() and namespace(N) would help with several >> scenarios. For example, if you want to create a new element with the >> same namespaces of an old element, or if you want to match elements >> that contain a certain namespace prefix. >> >> I can see no other way to do such matching/resolving other than using >> get-in-scope-namespaces then resolving each prefix. >> >> Would the working please consider: >> - a clarification sentence regarding namespaces, though written inline >> as attributes, cannot be matched as such >> - adding the KindTests namespace() and namespace(N) where N is a QName >> > >
Received on Monday, 6 October 2003 16:55:50 UTC