[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: How to match on namespace prefix

Subject: Re: How to match on namespace prefix
From: Chris Lilley <chris@xxxxxx>
Date: Mon, 11 Jan 1999 22:30:41 +0100
multiple namespaces xsl match prefix

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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.