Re: [xsl] Can't make template match root element with schema info

Subject: Re: [xsl] Can't make template match root element with schema info
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 16 Mar 2005 12:36:27 GMT
  Kindly bear these slip-ups as coming from someone who's still learning. How
  many different kinds of namespaces are there in XSLT.

Oh yes sorry I didn't mean to criticize. (You could always criticise my
typing accuracy if it came to that:-)

However if people use completely wrong terminology then it's not too
confusing as you can guess what they mean and react accordingly, but if
you are unlucky and the terminology is correct (but doesn't mean what
was intended) then it's harder to spot that a translation is required.

  How many different kinds of namespaces are there in XSLT.

  1. no-namespace
  2. default namespace
  and is there any other?

Well if you phrase it that way there are others yes, such as namespaces
that are neither the default (and are not no-namespace). But listing the
choices like that is confusing as they are really independent.

There is the syntactic/structural distinction:

All namespaces have a namespace name which is a URI such as
there is one special case of a  "null namespace"  for elements that are
not in a namespace at all. XSLT essentially treast no-namespace as a
namespace with namespace URI the empty string "" so you often hear this
called the nul namespace or similar terms, although the namespace rec,
says that such elements are not in a namespace.
So your first distiction is saying whether the namespace has a namespace
URI or not.

Then there is a syntactic issue, if an element is in a namespace say
element xx in namespace http://foobar then it may appear with (any)
prefix or with no prefix, but Xpath essentially treats all these things
as equivalent, just as <x n="2"/> and  <x n='2'/>  are equivalent.
<xx xmlns="http://fooobar"/>
<p:xx xmlns:p="http://fooobar"/>
<zzz:xx xmlns:zzz="http://fooobar"/>

the term "default namespace"  refers to using the first unprefixed from
above. But this is essentially a syntactic issue apart from one (or
two:-) special functions XSLT and XPath can not tell that the default
namespace syntax was used, and if it was not used, it can't tell which
prefix was used. In all the cases above you woul duse the same match
expression something like

match="qqq:xx"  xmlns:qqq="http://fooobar";

I think the faq for this list has more on this


This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:

Current Thread