Re: cannot find the namespace declarations from an extension function
Michael Ludwig <[email protected]>
| Newsgroups | gmane.text.xml.xalan.java.user |
|---|---|
| Message-ID | <[email protected]> |
Adrian Herscu schrieb: >> But on this list the view should probably be Xalan, hence XSLT and >> the XPath Data Model. A namespace declaration attribute isn't an >> attribute in XDM, because it's not on the attribute axis. The fact >> that namespace declaration serialization happens to take attribute >> form doesn't matter. >> >>>> That's why it doesn't show up among the attributes, neither in DOM >>>> nor in XDM (XPath Data Model). > > Seems like XDM is related to XPath 2.0. The data model in XPath 1.0 is > described at http://www.w3.org/TR/xpath#data-model Hi Adrian! Seven disjunct kinds of nodes in XPath 1.0 (and 2.0), among which we find attribute nodes and namespace nodes. > According to http://www.w3.org/TR/xpath#namespace-nodes > > This means that an element will have a namespace node: > * for every attribute on the element whose name starts with xmlns:; > * for every attribute on an ancestor element whose name starts xmlns: > unless the element itself or a nearer ancestor redeclares the prefix; > * for an xmlns attribute, if the element or some ancestor has an xmlns > attribute, and the value of the xmlns attribute for the nearest such > element is non-empty > > They are called "attributes"! Yes, at the XML syntax level - not, however, in the XPath data model. Probably best explained historically. First, XML syntax. Then, in January 1999, XML Namespaces. In November 1999, XSLT and XPath 1.0. With XML, the syntax came first. Later, various data models were devised to work with an abstraction of this XML syntax, maybe dropping parts of it (like the physical structure, entities), maybe conserving parts (ID-typed attributes), maybe adding stuff not originally present in XML (W3C XML Schema and PSVI). So the XPath 1.0 data model is a view of XML that channels the special xmlns attributes into namespace nodes and plain attributes into attribute nodes. > Also in DOM2 Core there is nothing that suggests that "namespace > attributes" are not just regular attributes. You're right. I said the namespace declaration attributes wouldn't show up among the attributes, neither in DOM nor in XDM. For XDM, that was correct, but for DOM, it wasn't. Sorry for misleading you. I was led to think and say so because I was used to the version of the DOM API offered by LibXML2, which maybe isn't a strict *implementation* of the *specification*. Whatever it is, it doesn't list the namespace declaration attributes among the ordinary attributes. I asked on the Xerces-Java list for clarification. DOM: Are namespace declaration attributes real attributes? http://markmail.org/thread/4cxxce3ny5hb5qmo It seems DOM is more of a moving target with three levels and many options, at least in level 3, one of which is whether or not to include the namespace declaration attributes among the ordinary attributes. See this reply I got: Re: DOM: Are namespace declaration [...] - Michael Glavassevich http://markmail.org/message/en7dkrkejkzuug4o So it *seems* to me now that for DOM Level 2, namespace declaration attributes are ordinary attributes, while for DOM Level 3 they may get special treatment. (But maybe some expert can clarify further.) For XPath, at any rate, they're not attributes any more. I guess you could see this as an increasingly strict adoption and tight integration of XML namespaces. Cheers, Michael Ludwig