|
Subject: Re: How to match on namespace prefix From: Chris Lilley <chris@xxxxxx> Date: Mon, 11 Jan 1999 22:30:41 +0100 |
Francois Belanger wrote:
>
> James Clark wrote on 04/01/99 19h16:
> >Issue (pattern-namespace-wildcards): Should patterns of the form foo:*
> >or *:foo be allowed?
>
> Yes, it's really needed, so is @*:foo or @foo:* for attributes, the
> syntax is simple and intuitive.
No, it should not be allowed.
However, the probelem that the proposal is trying to solve should be
solved.
In CSS, solutions of the form
@namespace foo url(someurlgoeshere);
foo:X { font-style: italic}
are being considered, which given the instance
<xyz xmlns:bar='someurlgoeshere' xmlns:foo='adifferenturl'>
<bar:X>this element is in italics</bar:X>
<foo:X>This one is not</foo:X>
</xyz>
would match bar:Xm in other words the one from the correct namespace.
(It might be that we pick a different separator that : which is
currently not legal in a selector unless escaped.)
The key point here is that equality is beased on the declared namespace
*name*, not the namespace *prefix* which happend to be used in a
particular instance. This increases the robustness of the style sheet
and allows it to be applied to content which happens, for some good
reason, to use a different namespace prefix. It also stops unwanted
selection of unrelated elements from a diufferent namespace, that happen
to use the same namespace prefix.
It would be desirable for the XSL solution to exhibit a similar
robustness. An appropriate XML construct would be used to replace the
at-rule.
In the CSS WG we discussed making the @namespace a block container but
found that this precluded contextual selectors that use multiple
namespaces (select all elements Q from namespace w that are children of
element A from namespace s).
> >If so, should * match any element or any element
> >without a namespace URI?
>
> * should match any nodes (it's what one expects). I would expect to
> write *:* if I want all nodes who are part of any namespace.
This problem goes away if matching is via the namespace name. In the
CSS example above, foo:X matches elements called X from the namespace
declared by 'someurlgoeshere' regardless of whether the elements in the
document instance are prefixed with a namespace prefix or whether they
are in the default namespace (ie have no prefix).
So * matches all elements in all namespaces. foo:* matches all elements
in the namespace declared by 'someurlgoeshere' (regardless of whether
they happen to have an explicit namespace prefix in the document
instance) and *:X matches all elements called X in all namespaces.
--
Chris
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: How to match on namespace prefi, James Clark | Thread | Re: How to match on namespace prefi, James Clark |
| Re: Standard API to XSL processors, Tyler Baker | Date | Re: Producing multiple result files, G. Ken Holman |
| Month |